[Coral-dev] Linker error with coral_read_pkt()

Ken Keys coral-info at caida.org
Thu Jul 7 10:33:39 PDT 2005


The attached patch should fix this problem.  Apply it to the
coral-3.7.4-public or coral-3.7.4-member source tree and re-install.

On Thu, Jul 07, 2005 at 12:07:35PM +0200, Siva Ramagopal wrote:
> Hi all,
> 
> I'm including libcoral.h in two different C++ files. Compiling them
> separately into their respective object files gives no problems.
> However, when I link together the two object files, I get an error
> complaining about the multiple inclusion of coral_read_pkt().
> 
> Error:
> $:~/testarea> g++ -I ~/bin/Coral/include -g -Wall coraltest.cc dummy.cc
> -L ~/bin/Coral/lib -L ~/lib/lib -lcoral -lpcap -lz
> /tmp/ccwlqoSc.o(.bss+0x0): In function `dummy_func()':
> /home/user1/testarea/dummy.cc:3: multiple definition of `coral_read_pkt'
> 
> /tmp/cccvetVD.o(.bss+0x0):/home/user1/testarea/coraltest.cc:10: first
> defined here
> collect2: ld returned 1 exit status
> 
> coraltest.cc is a simple program to count the number of packets in a
> tracefile. dummy.cc just includes unistd.h, sys/param.h and libcoral.h.
> 
> I'm using gcc 3.3.3 on AMD64/SuSE Linux 9.1.
> 
> I could be missing something obvious here, but after several hours of
> racking my brains, I gave up :(
> I'd greatly appreciate any help here,
> TIA,
> -Shiva
> 
> _______________________________________________
> Coral-dev mailing list
> Coral-dev at caida.org
> http://rommie.caida.org/mailman/listinfo/coral-dev

-- 
Ken Keys
CoralReef:  http://www.caida.org/tools/measurement/coralreef/
-------------- next part --------------
Index: libsrc/libcoral/coral_pkt.c
===================================================================
RCS file: /cvs/coral3/libsrc/libcoral/coral_pkt.c,v
retrieving revision 1.216
diff -u -r1.216 coral_pkt.c
--- libsrc/libcoral/coral_pkt.c	2004/08/03 18:14:23	1.216
+++ libsrc/libcoral/coral_pkt.c	2005/07/07 17:28:26
@@ -72,6 +72,9 @@
 static const struct timeval tvzero = { 0, 0 };
 static const struct timespec tszero = { 0, 0 };
 
+coral_iface_t *(*coral_read_pkt)(coral_pkt_result_t *pkt_result,
+    coral_interval_result_t *interval_result);
+
 #define is_pkt_iface(I) \
     ((I) && (pi->iface ? (I) == pi->iface : pi->src ? (I)->src == pi->src : 1))
 
Index: libsrc/libcoral/libcoral.h
===================================================================
RCS file: /cvs/coral3/libsrc/libcoral/libcoral.h,v
retrieving revision 1.202
diff -u -r1.202 libcoral.h
--- libsrc/libcoral/libcoral.h	2005/03/22 01:07:27	1.202
+++ libsrc/libcoral/libcoral.h	2005/07/07 17:28:26
@@ -456,7 +456,7 @@
 
 int coral_read_pkt_init(coral_source_t *src, coral_iface_t *iface,
     struct timeval * interval);
-coral_iface_t *(*coral_read_pkt)(coral_pkt_result_t *pkt_result,
+extern coral_iface_t *(*coral_read_pkt)(coral_pkt_result_t *pkt_result,
     coral_interval_result_t *interval_result);
 const coral_pkt_stats_t *coral_get_iface_stats(coral_iface_t *iface);
 


More information about the Coral-dev mailing list