Re: keep getting "undefined reference to" linker error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"H.S." wrote:

> > function.  You could double check by looking at the generated assembler
> > source.)
> 
> er .. how? nm?

g++ -S, or g++ -save-temps, or objdump -d, or ...

> Yeah, that is what I tried earlier. If I use the header like so:
> #ifdef __cplusplus
> extern "C" {
> #endif
> #include <taucs.h>
> #ifdef __cplusplus
> }
> #endif // __cplusplus

I'm not sure that's valid.  I meant edit the taucs.h header so that the
block encloses declarations.  If you try to wrap the entire header like
that then it will apply to everything recursively that the header itself
includes, which leads to the kind of error you're seeing where you've
got a C++ header being interpreted as C, though I'm not sure how a C
library header ends up including C++ headers.

> Somebody at comp.lang.c++ pointed out that I should not need to enclose
> the header as shown above, the library should take care of that by itself.

Yes, this is a defect of the library's design.  It would appear that its
authors never intended for it to be used from/with a C++ compiler, so
another alternative would be to rename your file to have a .c extension
and compile with gcc.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux