public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Link problems in g++ but not in gcc!!
@ 2004-08-31 12:09 L.Suresh
  2004-08-31 12:18 ` Eljay Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: L.Suresh @ 2004-08-31 12:09 UTC (permalink / raw)
  To: gcc-help

Hi,
I'm having link problems when i compile my program iptables.cpp with
g++.

I have the following:
/usr/lib/libipq.a 
/usr/include/libipq.h 
/usr/share/man/man3/libipq.3.gz

I tried to compile like this.

g++ -o ipqtest iptables.cpp -lipq  <<--- Fails to compile.
g++ -o ipqtest iptables.cpp /usr/lib/libipq.a


gcc -o ipqtest iptables.c -lipq  <-- Compiles!!

I get the following error when i compile with g++. But when i change my
file name iptables.cpp to iptables.c and compile, it compiles without
any problems!!

Symbol list of libipq.a is:
libipq.o:
         U bind
         U close
         U __errno_location
         U fprintf
         U fputc
         U fputs
         U free
         U fwrite
         U getpid
00000260 T ipq_create_handle
00000550 T ipq_ctl
000003a0 T ipq_destroy_handle
00000000 D ipq_errmap
00000000 b ipq_errno
00000560 T ipq_errstr
00000460 T ipq_get_msgerr
00000470 T ipq_get_packet
00000450 T ipq_message_type
00000090 t ipq_netlink_recvfrom
00000050 t ipq_netlink_sendmsg
00000000 t ipq_netlink_sendto
00000580 T ipq_perror
00000440 T ipq_read
000003d0 T ipq_set_mode
00000480 T ipq_set_verdict
00000240 t ipq_strerror
         U malloc
         U recvfrom
         U select
         U sendmsg
         U sendto
         U socket
         U stderr
         U strerror


Error while compiling.

/tmp/ccEVoYgQ.o(.text+0xf): In function `die(ipq_handle*)':
: undefined reference to `ipq_perror(char const*)'
/tmp/ccEVoYgQ.o(.text+0x1d): In function `die(ipq_handle*)':
: undefined reference to `ipq_destroy_handle(ipq_handle*)'
/tmp/ccEVoYgQ.o(.text+0x37): In function `mains(int, char**)':
: undefined reference to `ipq_create_handle(unsigned, unsigned)'
/tmp/ccEVoYgQ.o(.text+0x6f): In function `mains(int, char**)':
: undefined reference to `ipq_set_mode(ipq_handle const*, unsigned char,
unsigned)'
/tmp/ccEVoYgQ.o(.text+0xa6): In function `mains(int, char**)':
: undefined reference to `ipq_read(ipq_handle const*, unsigned char*,
unsigned, int)'
/tmp/ccEVoYgQ.o(.text+0xd2): In function `mains(int, char**)':
: undefined reference to `ipq_message_type(unsigned char const*)'
/tmp/ccEVoYgQ.o(.text+0x104): In function `mains(int, char**)':
: undefined reference to `ipq_get_msgerr(unsigned char const*)'
/tmp/ccEVoYgQ.o(.text+0x12f): In function `mains(int, char**)':
: undefined reference to `ipq_get_packet(unsigned char const*)'
/tmp/ccEVoYgQ.o(.text+0x154): In function `mains(int, char**)':
: undefined reference to `ipq_set_verdict(ipq_handle const*, unsigned,
unsigned, unsigned, unsigned char*)'
collect2: ld returned 1 exit status


Any help would be highly appreciated.

Thanks,
L.Suresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-31 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-31 12:09 Link problems in g++ but not in gcc!! L.Suresh
2004-08-31 12:18 ` Eljay Love-Jensen
2004-08-31 20:35   ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).