Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

LAPACK LNK2019 error using Visual Fortran XE 12

Jim_Vickroy
Beginner
318 Views

Hello,

I'm developing my first Fortran 95 application requiring procedures in LAPACK.

My environment is:

+ MS Windows XP
+ MS Visual Studio 2008
+ Intel Visual Fortran Compiler XE 12.0.1.127 [IA-32]

The project build step fails as follows:

1>------ Build started: Project: SUVI Thematic Maps Demo, Configuration: Debug Win32 ------

1>Compiling with Intel Visual Fortran Compiler XE 12.0.1.127 [IA-32]...

1>demo.f90

1>Linking...

1>SUVI Thematic Maps Lib.lib(products.obj) : error LNK2019: unresolved external symbol _SGETRF_MKL95@12 referenced in function _THEMATIC_MAP_COMPONENT_mp_THEMATIC_MAP_SET_COVARIANCES_DETERMINANTS_INVERSES

1>SUVI Thematic Maps Lib.lib(products.obj) : error LNK2019: unresolved external symbol _SGETRI_MKL95@12 referenced in function _THEMATIC_MAP_COMPONENT_mp_THEMATIC_MAP_SET_COVARIANCES_DETERMINANTS_INVERSES

1>Debug\\SUVI Thematic Maps Demo.exe : fatal error LNK1120: 2 unresolved externals

1>

1>Build log written to "file://C:\\Documents and Settings\\jim.vickroy\\My Documents\\Visual Studio 2008\\Projects\\SUVI Thematic Maps\\SUVI Thematic Maps Demo\\Debug\\BuildLog.htm"

1>SUVI Thematic Maps Demo - 3 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

My Visual Studio "Solution" comprises two "Projects": a "Demo" Project (containingthe main program) and a static library project (which uses some LAPACK procedures).

I believe I have followed the steps presented in "Creating, Configuring, and Running the Intel Visual Fortran Project" sub-section of "Programming with Intel Math Kernel Library in the Visual Studio* Integrated Development Environment (IDE)".

My online search located a posting entitled "Problems linking with mkl95 libraries" {http://software.intel.com/en-us/forums/showthread.php?t=71093&o=d&s=lr&wapkw=(rss)} but that posted solution did not work.

Thanks in advance for your time and responses.

-- jv

0 Kudos
4 Replies
mecej4
Honored Contributor III
318 Views
You probably have the CVF calling convention specified as an option in your project. However, the Lapack95 libraries delivered with IFort contain only routines with the IFort default calling convention.

Either remove the /iface:cvf option in your project, or build a CVF compatible version of the MKL-Lapack95 library and use it instead of the delivered library.
0 Kudos
Jim_Vickroy
Beginner
318 Views
Ahh ... you are correct ... I am using the /iface:cvf compiler option because it was required for another external dependency.

Building the MKL-Lapack libray with the CVF calling convention seems daunting to me given my level of expertise so I will probably just hand-code the 2 Lapack procedures needed using the Numerical Receipes book.

Thanks for explaining this.
0 Kudos
mecej4
Honored Contributor III
318 Views
I will probably just hand-code the 2 Lapack procedures

No need for that, MKL already has SGETRF and DGETRF callable with CVF calling sequence.

All you have to do is to replace the calls to the overloaded subroutine names, e.g., GETRF, by the F77 calls, which have more arguments than the F95-callable subroutines -- in fact, something that you would have to do even if you used the Lapack source code from Netlib or the equivalent from Numerical Recipes.
0 Kudos
Jim_Vickroy
Beginner
318 Views
Oh ... thanks for this information!

If not obvious, I'ma completenovice!
0 Kudos
Reply