This is the mail archive of the gcc-bugs@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]

FW: g++ / CC compatibility


Also, if I compile the static library using CC and then try to build the
executable using g++, I get undefined references to symbols in libCrun.  The
CC command I used is  CC -xar -o libtest.a *.o -L/usr/lib -lpthread -lthread
-lsocket -lnsl -lrt -lCrun.

Basically whichever of g++ OR CC that allows us to build a library that the
client could use  to build an executable, using g++ or CC their choice, we
will use.

>  -----Original Message-----
> From: 	Nevenka Bierny  
> Sent:	Wednesday, May 16, 2001 6:31 PM
> To:	'gcc-bugs@gcc.gnu.org'
> Subject:	g++ / CC compatibility
> 
> I'm trying to build a static library using g++, which I can then use to
> build an executable using CC (clients who compile using our library may
> not have g++).
> 
> If I build the static library using the following commands:
> 	g++ -c *.cpp
> 	ar -r libtest.a *.o
> 
> and try to compile an executable using the following commands:
> 	CC -o SimpleTest SimpleTest.cpp -L. -lsocket -lnsl -lrt -ltest
> 
> I get "undefined symbol" errors for symbols which are in libg++
> (__builtin_delete, etc).
> 
> 
> 
> I can get around this problem by building a shared library using the
> following commands:
> 	g++ -c *.cpp
> 	g++ -shared -o libtest.so *.o -L. -lpthread -lthread -lsocket -lnsl
> -lnrt -ltest
> 	and add the path for libtest.so to LD_LIBRARY_PATH.
> 
> However, speed is of importance, milliseconds do matter, therefore we
> would rather build a static library which can then be used to build an
> executable using CC or g++.
> 
> 
> Is there any way to build a static library using g++ rather than a shared
> one?
> 
> Thanks.


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