Re: extern "C" and undefined reference
- From: Diomidis Spinellis <dds@xxxxxxx>
- Date: Mon, 23 Apr 2007 02:13:47 +0300
Andrew Pantyukhin wrote:
7zip developers converted some code from C++ to C,
while leaving the main stand-alone lzma app in C++.
They use 'extern "C" { }' blocks around #include's
referencing C headers.
Everything compiles fine, but "undefined reference"
errors appear at linkage. The undefined references
are to the C functions included from withing those
'extern "C"' wrappers. I tried to remove the
wrappers from some files and the amount of errors
decreased a bit. Is there a better workaround?
Google came up with two results: remove the wrappers
or use c++ instead of cc. I'm already using c++.
Many of the C headers are available in a different form for C++ programs. For example, in a C++ program you can #include <cstdio> instead of <stdio.h>.
You can use nm(1) on the .o files to see where the problem comes from.
Diomidis
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: extern "C" and undefined reference
- From: Andrew Pantyukhin
- Re: extern "C" and undefined reference
- References:
- extern "C" and undefined reference
- From: Andrew Pantyukhin
- extern "C" and undefined reference
- Prev by Date: extern "C" and undefined reference
- Next by Date: Re: extern "C" and undefined reference
- Previous by thread: extern "C" and undefined reference
- Next by thread: Re: extern "C" and undefined reference
- Index(es):
Relevant Pages
|
|