keep getting "undefined reference to" linker error
H.S.
hs.samix@gmail.com
Fri Aug 10 04:30:00 GMT 2007
Brian Dessent wrote:
>
> 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.
hmm .. I will have to look into. Not a pleasant task I might say.
>> 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.
Yes, this I have already tried. I again again get tons of errors, I
think similar to the earlier ones I reported ... I could be wrong
though. Here are the command run for the compilation:
$> make -n
gcc -g -Wall -c -ansi -Wno-deprecated -I./
-I/home/hs/tmp/taucs/build/linux -I/home/hs/tmp/taucs/src spmat.cc -o
spmat.o
gcc spmat.o -o spmat /home/hs/tmp/taucs/lib/linux/libtaucs.a
-L/home/hs/tmp/taucs/lib/linux -ltaucs
-L/home/hs/tmp/taucs/external/lib/linux -latlas -llapack -lf77blas
-lcblas -latlas -lmetis -lm -lg2c
Here is a sample output from the above commands:
/usr/include/c++/4.1.3/complex:529: error: template with C linkage
/usr/include/c++/4.1.3/complex:534: error: template with C linkage
/usr/include/c++/4.1.3/complex:539: error: template with C linkage
/usr/include/c++/4.1.3/complex:544: error: template with C linkage
/usr/include/c++/4.1.3/complex:550: error: template with C linkage
/usr/include/c++/4.1.3/complex: In function âdouble
std::__complex_abs(double __complex__)â:
/usr/include/c++/4.1.3/complex:569: error: declaration of C function
âdouble std::__complex_abs(double __complex__)â conflicts with
/usr/include/c++/4.1.3/complex:566: error: previous declaration âfloat
std::__complex_abs(float __complex__)â here
/usr/include/c++/4.1.3/complex: In function âlong double
std::__complex_abs(const long double __complex__&)â:
/usr/include/c++/4.1.3/complex:572: error: declaration of C function
âlong double std::__complex_abs(const long double __complex__&)â
conflicts with
/usr/include/c++/4.1.3/complex:569: error: previous declaration âdouble
std::__complex_abs(double __complex__)â here
/usr/include/c++/4.1.3/complex: At global scope:
/usr/include/c++/4.1.3/complex:575: error: template with C linkage
/usr/include/c++/4.1.3/complex:586: error: template with C linkage
/usr/include/c++/4.1.3/complex: In function âdouble
std::__complex_arg(double __complex__)â:
/usr/include/c++/4.1.3/complex:596: error: declaration of C function
âdouble std::__complex_arg(double __complex__)â conflicts with
/usr/include/c++/4.1.3/complex:593: error: previous declaration âfloat
std::__complex_arg(float __complex__)â here
/usr/include/c++/4.1.3/complex: In function âlong double
std::__complex_arg(const long double __complex__&)â:
/usr/include/c++/4.1.3/complex:599: error: declaration of C function
âlong double std::__complex_arg(const long double __complex__&)â
conflicts with
/usr/include/c++/4.1.3/complex:596: error: previous declaration âdouble
std::__complex_arg(double __complex__)â here
/usr/include/c++/4.1.3/complex: At global scope:
/usr/include/c++/4.1.3/complex:602: error: template with C linkage
/usr/include/c++/4.1.3/complex:616: error: template with C linkage
/usr/include/c++/4.1.3/complex:628: error: template specialization with
C linkage
hmm ... what do I do next?
thanks,
->HS
> Brian
>
More information about the Gcc-help
mailing list