News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

How to configure Lapack external libraries with C::B

Started by asd34, June 03, 2012, 11:53:54 AM

Previous topic - Next topic

asd34

hi all,

I'm new to the C:B enviroment. I wish to use the lapack libraries in the C::B IDE. Allthough I've managed to accurately configure the compiler and linker for gfortran. I couldn't figure out how to set up properly the external fortran libraries in Ide. I followed the guidance given in that link http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/

I set search directories, and compiler and linker libraries carefully under compiler debugger options, but it seems the program still coudn't locate the libraries and complains the "undefined reference to ......" I also set the path variable in the enviromental settings to point to the correct directory where required libraries resides but with no success.

What am I doing wrong?

Regards,


Freem

We could have some use of the compile logs.
Especially the command used to link which is inside it.

In fact, we can do nothing without it. And it is highly probable that you could just look at it to find yourself the problem and fix it, in fact.

asd34

Thanks for commenting ,
here is the log. but that doesn't ring any bell for me .
Everything that I know which malfunctioning is there, but don't know how to fix it.

The complained routines are missign subroutines, they reside in the blas.lib and lapack.lib static libraries.
I've added and specified directories conatining them properly but still doesn't work for me?

||=== Fort_empty, Debug ===|
obj\Debug\main_fort.o||In function `my':|
...Fort_empty\main_fort.f90|72|undefined reference to `dlansy_'|
...Fort_empty\main_fort.f90|73|undefined reference to `dlansy_'|
...Fort_empty\main_fort.f90|82|undefined reference to `dsygv_'|
...Fort_empty\main_fort.f90|104|undefined reference to `x04caf_'|
...Fort_empty\main_fort.f90|110|undefined reference to `dtrcon_'|
...Fort_empty\main_fort.f90|124|undefined reference to `dlamch_'|
...Fort_empty\main_fort.f90|130|undefined reference to `ddisna_'|
||=== Build finished: 7 errors, 0 warnings ===|

Regards,


stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

asd34

thanks for helping,

I deliberately followed the links you provided, putting IDE into verbose mode did helped me, but didn't solve the problem in overall.
I even tried to change the dependency in under the Project>Properties>Build Target>Dependencies without success.

Here is the verbose output.

gfortran.exe -LE:\TEST_FOLDER\lapack_lib -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib -o bin\Debug\Fort_empty.exe obj\Debug\main_fort.o E:\TEST_FOLDER\lapack_lib\blasd.lib E:\TEST_FOLDER\lapack_lib\extrasd.lib E:\TEST_FOLDER\lapack_lib\lapack.lib E:\TEST_FOLDER\lapack_lib\lapack.lib E:\TEST_FOLDER\lapack_lib\blas.lib E:\TEST_FOLDER\lapack_lib\blas.lib E:\TEST_FOLDER\lapack_lib\lapack.lib
obj\Debug\main_fort.o: In function `my':
.../CB Projects/Fort_empty/main_fort.f90:72: undefined reference to `dlansy_'
.../CB Projects/Fort_empty/main_fort.f90:73: undefined reference to `dlansy_'
.../CB Projects/Fort_empty/main_fort.f90:82: undefined reference to `dsygv_'
.../CB Projects/Fort_empty/main_fort.f90:104: undefined reference to `x04caf_'
.../CB Projects/Fort_empty/main_fort.f90:110: undefined reference to `dtrcon_'
.../CB Projects/Fort_empty/main_fort.f90:124: undefined reference to `dlamch_'
.../CB Projects/Fort_empty/main_fort.f90:130: undefined reference to `ddisna_'
collect2: ld returned 1 exit status

What really am I doing wrong?

oBFusCATed

Quote from: asd34 on June 06, 2012, 06:44:17 PM
What really am I doing wrong?
You're not searching the internet using part of the error message, like searching for "undefined reference to `dlansy_'" ...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

xunxun

Please note, which compiler is your lapack.lib/blas.lib built?
If lapack.lib/blas.lib is built using intel compiler, there will be a capital symbol for this.

So there will be no dlansy_, and there will be only "DLANSY"

To solve the issue, you can rebuild lapack using gfortran.
Or using Fortran 2003 ISO_C_BINDING Module to change the symbol.
Regards,
xunxun