Using lapack in C

I am working on understanding the same physics code in C that uses Lapack, which I have never used before. I used sudo apt-get to install lapack. and I compile with

gcc -llapack Dirac.c -o Dirac -lm 

and I get the compilation error "undefined reference to" zheev "" I know that zheev is a function in the lapak, so I believe that something went wrong with the installation or something is not in the right place. Can someone explain if I need to make any links or where I need to save things so that they can be compiled? I apologize if this is a question about the noob.

+4
source share
1 answer

You need to put the library at the end of the compilation when you link the program:

 gcc Dirac.c -o Dirac -llapack -lm 

How the linking process works is that the library is used to look for unresolved characters that have appeared so far. When you put -llapack first, since your program does not yet have unresolved characters (since it has not compiled anything yet), this does not lead to the use of a library.

+4
source

Source: https://habr.com/ru/post/1491750/


All Articles