This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
FW: g++ / CC compatibility
- To: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Subject: FW: g++ / CC compatibility
- From: Nevenka Bierny <NBierny at quova dot com>
- Date: Wed, 16 May 2001 19:06:29 -0700
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.