This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: keep getting "undefined reference to" linker error
Brian Dessent wrote:
> "H.S." wrote:
>
>> 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
>
> Just switching to gcc isn't sufficient, it still has the .cc extension.
>
> Brian
>
Compiles perfectly! Thanks for pointing out that mistake of mine.
$> make
gcc -g -Wall -c -ansi -Wno-deprecated -I./
-I/home/hs/tmp/taucs/build/linux -I/home/hs/tmp/taucs/src spmat.c -o
spmat.o
cc1: warning: command line option "-Wno-deprecated" is valid for
C++/Java/ObjC++ but not for C
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
So, any advice how I can get this working with a C++ program? This was
just a test program, eventually I want to call the library routines from
a larger C++ project I am working on. If there is way to create a
routine which does this in C and then link to it with my C++ program,
that would be great too, but I guess I will still need to solve the
problem of including taucs.h somehow.
regards,
->HS