Hi I am new to Fortran and am getting the below error when I try and compile using ifort 100.f90

/tmp/ifortN2Zshv.o: In function `MAIN__':
100.f90:(.text+0x25a2): undefined reference to `zgesv_'

I am not sure how to correct this and cannot find anything in my searches so any help would be appreciated.

zgesv_ is a variable or function you tried to use but didn't define. Hence "undefined reference"

How do I define it then sorry?

Through my crystal ball I see that you need to add -llapack -lblas to your linker command line.

ifort 100.f90 -L/Lib/blas_LINUX -L/Lib/lapack_LINUX
/tmp/ifort4orRdn.o: In function `MAIN__':
100.f90:(.text+0x27d2): undefined reference to `zgesv_'


I am still getting the same issue sorry

-L tells the linker where to look for libraries. It still needs to know which libraries to link in. That's what -l option is for.
add -llapack -lblas

So ifort 100.f90 -L/Lib/ -llapack_LINUX -lblas_LINUX ?

--------------

ifort 100.f90 -L/Lib/ -llapack_LINUX -lblas_LINUX
ld: cannot find -llapack_LINUX

You have to check your installation. For starters, linux filenames are case sensitive. Do you have a /Lib directory with the capital L? If so, what is the output of find /Lib -name "libblas*" ? If not, try the same with /lib instead of Lib.

find /Lib -name "libblas*"
find: /Lib: No such file or directory
h2:~> dir
total 41412
-rw-r--r-- 1 hpc12 h2 4280 Apr 15 08:14 100.f90
drwxr-xr-x 2 hpc12 h2 92 Apr 14 10:32 Lib
-rw-r--r-- 1 hpc12 h2 21193536 Apr 12 03:56 lapack_LINUX.a
-rw-r--r-- 1 hpc12 h2 21193536 Apr 12 03:56 liblapack_LINUX.a

> find: /Lib: No such file or directory
OK, you have no /Lib, meaning that -L/Lib/ points to nowhere.

h2:~> dir

This is even better. You do have lapack library. What is the directory name ( pwd at the command prompt)? BTW, I am positive that you absolutely need blas; do you have it? find / -name "libblas*"

Thanks so much this is driving me insane and I really need to work it out a.s.a.p.

blas_LINUX.a
lapack_LINUX.a
liblapack_LINUX.a

Thank me when we reach some result.
Now, which directory liblapack resides in? Same for lapack and blas.
Just in case, are they valid libraries - what does nm liblapack_LINUX.a display?.
> this is driving me insane
Is this your first deadline? Relax, there are many more ahead. Insanity is not productive.

I got it working using ifort 100.f90 lapack_LINUX.a blas_LINUX.a and moving the libraries into the same directory as the code

Thanks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.