dynamic shared library that includes both C++ and C sources

Keith Bostic bostic@abyssinian.sleepycat.com
Mon Oct 4 09:33:00 GMT 1999

> From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
> On Oct  4, 1999, Keith Bostic <bostic@abyssinian.sleepycat.com> wrote:
>> abyssinian:build_local {312} cc -g -I. -Wall -W t.c .libs/libdb-3.0.so
>> t.c: In function `main':
>> .libs/libdb-3.0.so: undefined reference to `terminate(void)'
>> 4. Note, you can build the source file correctly if you use C++:
>> abyssinian:build_local {315} g++ -g -I. -Wall -W t.c .libs/libdb-3.0.so
>>    works.
> g++ implicitly links with -lstdc++, where terminate is defined; cc
> doesn't.

I don't understand why this is relevant, would you please
expand on your answer?

I realize that g++ can compile programs when linked with a
library that contains both C++ and C modules.

What I don't understand is why gcc cannot compile standard C
programs when linking with a library that includes both C++ and
C modules.  Why should programmers have to know that a library
contains both C++ and C modules when selecting a compiler for
their application?


Keith Bostic			bostic@bostic.com
394 E. Riding Dr.		+1-978-287-4781
Carlisle, MA 01741		http://www.bostic.com

More information about the Gcc-bugs mailing list