This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld & my Makefile


Dear all,
I wrote a program in C, Not C++.It work good.But when i use "-x c++" in
Makefile, i receive following errors:
///////////////////////////////////////////////////////////////////////////////
debian:/home/mohsen/workspace/urldump# make
gcc -o urldump  urldump.o base64.o buf.o pcaputil.o chksum_ctl.o
postgres.o linked_list.o   -lresolv -lnsl -lrpcsvc  -lpcap -lnet -lnids
-L. -lpq -lpthread 
postgres.o:(.data+0x0): multiple definition of `conninfo'
urldump.o:/home/mohsen/workspace/urldump/./urldump.c:315: first defined
here
/usr/bin/ld: warning: libnet.so.1, needed
by /usr/lib/gcc/i486-linux-gnu/4.3.4/../../../../lib/libnids.so, may
conflict with libnet.so.0
urldump.o: In function `__static_initialization_and_destruction_0(int,
int)':
urldump.c:(.text+0x22): undefined reference to
`std::ios_base::Init::Init()'
urldump.c:(.text+0x27): undefined reference to
`std::ios_base::Init::~Init()'
urldump.o: In function `flushing(void*)':
urldump.c:(.text+0xce): undefined reference to `flush_to_db(int)'
urldump.o: In function `process_http_request(tuple4*, unsigned char*,
int)':
urldump.c:(.text+0x359): undefined reference to `buf_init(buf*, unsigned
char*, int)'
urldump.c:(.text+0x378): undefined reference to `buf_tok(buf*, void*,
int)'
urldump.c:(.text+0x3a7): undefined reference to `buf_seek(buf*, int,
int)'
urldump.c:(.text+0x4f0): undefined reference to `base64_pton(char
const*, unsigned char*, unsigned int)'
urldump.c:(.text+0x5fe): undefined reference to `buf_tok(buf*, void*,
int)'
urldump.c:(.text+0x653): undefined reference to
`libnet_host_lookup(unsigned long, unsigned short)'
urldump.c:(.text+0x693): undefined reference to
`libnet_host_lookup(unsigned long, unsigned short)'
urldump.c:(.text+0x6b1): undefined reference to
`libnet_host_lookup(unsigned long, unsigned short)'
urldump.c:(.text+0x6d1): undefined reference to `filling_node(char*,
char*, char*, char*, char*)'
urldump.c:(.text+0x6ec): undefined reference to `buf_index(buf*, void*,
int)'
urldump.o: In function `main':
urldump.c:(.text+0x8d9): undefined reference to `strconcat(char*, ...)'
urldump.c:(.text+0x8e3): undefined reference to `pg_connect()'
urldump.c:(.text+0xa15): undefined reference to `copy_argv(char**)'
urldump.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [urldump] Error 1
/////////////////////////////////////////////////////////////////////////////////////////////////

Following file is my Makefile :
/////////////////////////////////////////////////////////////////////////////////////////////
srcdir          = .

#install_prefix  =
prefix          = /usr/local
exec_prefix     = ${prefix}
libdir          = ${exec_prefix}/lib
target         = /opt/urldump
#mandir          = ${prefix}/man

CC      = gcc
CFLAGS  =  -g  -Wall  -pthread -DHAVE_NET_ETHERNET_H -DLIBNET_LIL_ENDIAN
-DDSNIFF_LIBDIR=\"$(libdir)/\" 
CPP     = -x c++ -llibstcd++

LIBS    = -lresolv -lnsl -lrpcsvc  -lpcap -lnet -lnids -L$(srcdir) -lpq
-lpthread
#RANLIB  = ranlib

HDRS    = base64.h buf.h options.h pcaputil.h version.h chksum_ctl.h
postgres.h linked_list.h
LIBOBJS = dummy.o strlcpy.o strlcat.o md5.o 




urldump: urldump.o base64.o buf.o pcaputil.o chksum_ctl.o postgres.o
linked_list.o
        $(CC) -o $@  urldump.o base64.o buf.o pcaputil.o chksum_ctl.o
postgres.o linked_list.o   $(LIBS)  -lc

urldump.o:
        $(CC) $(CPP) $(CFLAGS) -L/usr/lib/postgresql/8.4/lib/  -I.
-I/usr/include/postgresql/ -c $(srcdir)/$*.c

libmissing: $(LIBOBJS)
        $(CC) -shared -Wl,-soname,libmissing.so.1 -o
$(srcdir)/libmissing.so.1.0.0 md5.o strsep.o strlcpy.o strlcat.o
memcmp.o ethers.o dummy.o err.o dirname.o -lc  
        #$(RANLIB) $@

$(LIBOBJS):
        $(CC) -fPIC $(CFLAGS) $(INCS) -I. -I./missing/ -c
$(srcdir)/missing/*.c



clean:
        rm -rf *.o;rm -rf libmissing.so.1.0.0 
        rm -rf ./missing/*.o 
        rm -rf urldump                  
cleanu:
        rm -rf urldump
        rm -rf urldump.o     
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


What's My error?
Please help me.......


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]