I am new to lapack and I want to use the standard c interface in my c++ code. But I run into the following problem while I was trying to link the program to lapacke.a library.
I complied the 3.4.1 version of lapack with the default make.inc file. And then I compiled the lapacke library. The tests for lapacke worked very well.
I copied the code from lapack-3.4.1/lapacke/example/example_DGESV_rowmajor.c directly into a cpp file and began to compile.
I use eclipse and it gives me the following information:
********* information begins **********
Invoking: GCC C++ Linker
g++ -o "testfortranc" ./src/main.o -llapack -lrefblas -ltmglib -llapacke -L/home/huyaoyu/Libraries/lapack-3.4.1 -lm
/home/huyaoyu/Libraries/lapack-3.4.1/liblapacke.a(lapacke_dgesv_work.o): In function `LAPACKE_dgesv_work':
lapacke_dgesv_work.c:(.text+0x175): undefined reference to `dgesv_'
lapacke_dgesv_work.c:(.text+0x23c): undefined reference to `dgesv_'
collect2: ld returned 1 exit status
make: *** [testfortranc] Error 1
********* information ends *******
I noticed that there were likely problems that posted by other users. But I sill could not find a way to deal with it.
The example program uses gfortran as linker but I want to use g++ instead. Is there a way to use lapacke directly in c++ code with g++ as linker?
Thanks in advance!
