4

I am working on understanding a fellow physicist's code in C that uses Lapack, which I have never used before. I used sudo apt-get to install lapack. and I've been compiling with

gcc -llapack Dirac.c -o Dirac -lm 

and I'm getting the compiling error "undefined reference to 'zheev'" I know zheev is a function in lapack, so I'm figuring something went wrong with the install or something is not in the right place. Can someone please explain if i need to do some kind of linking or where i need to save things to get this to compile? I apologize if this is a noob question.

1 Answer 1

4

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

gcc Dirac.c -o Dirac -llapack -lm 

The way the linking process works is that the library is used to find unresolved symbols that have come up so far. When you put -llapack first, since there are not yet any unresolved symbols in your program (since it hadn't compiled anything yet), it doesn't end up using the library.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.