ifort - "undefined reference"

ifort - "undefined reference"

jenwang@ucdavis.edu's picture

Hi,

I was trying to compile a set of program using ifort and received the following error at the final linking stage:

lapack_single/my/test_psvd.o(.text+0xa52): In function `MAIN__': : undefined reference to `s_wsle' lapack_single/my/test_psvd.o(.text+0xa82): In function `MAIN__': : undefined reference to `do_lio'
...

Here are just some of the lines in the error message, there are more than 20 such lines stating the similar problem. test_psvd.f is the main program. My calling sequence is ifort -o test.out when I replaced ifort with g77, I can link just fine and executable test.out is produced, so I am sure that I incluced all the object files. Apparently, this is a problem with ifort. Does any one have any suggestion how to get around this?

Thanks!
Jeni

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Tim Prince's picture

References to the g77 runtime library would not be created in .o files built by ifort. If you have the source code, you must rebuild those g77 .o files using ifort.

jenwang@ucdavis.edu's picture

I did recompile using ifort and the same error occurs.
I pointed out that the program links successfully under the use of g77 in order to point out that non of the object files are missing from the source.

by the way, I am using MKL 7.2.1.

yager@netease.com's picture

Those functions are in libg2c.a. If you are lucky, add a "-lg2c" option at linking stage should solve the problem, or you need to search "libg2c.a" at /usr/lib or other directories, and using its absolute path.

Old mkl refers to those g2c functions.

Login to leave a comment.