Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29235 Discussions

Link error: Fortran static library + C++ main program (VS2008)

Zhanghong_T_
Novice
900 Views
Dear all,

I am trying to build a C++ main program which will call the Fortran subroutine built to static library, the libraries linked to the project are:
fortranlib.lib mkl_solver.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5mt.lib cxx.lib mpi.lib fmpich2.lib mkl_scalapack_core.lib mkl_blacs_mpich2.lib


However, the following errors appeared when built the project:
error LNK2001: unresolved external symbol _for_array_copy_in
error LNK2001: unresolved external symbol _for_array_copy_out


Other settings of the project are as follows:
C++->Command line:

/I "C:\Program Files\Intel\MKL\10.1.0.018\include\"/FD /EHsc /MT /Fo"Release_mpi\" /Fd"Release_mpi\vc90.pdb" /nologo /c /TP /errorReport:prompt

Linker->Command line:

/OUT:"\test.exe" /NOLOGO /LIBPATH:"C:\Program Files\MPICH2\lib" /LIBPATH:"C:\Program Files\Intel\MKL\10.1.0.018\ia32\lib\" /LIBPATH:"Lib32" /LIBPATH:"C:\Program Files\Intel\Compiler\11.0\066\fortran\lib\ia32" /MANIFEST /MANIFESTFILE:"Release_mpi\test.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DYNAMICBASE:NO /ERRORREPORT:PROMPT fortranlib.lib mkl_solver.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5mt.lib cxx.lib mpi.lib fmpich2.lib mkl_scalapack_core.lib mkl_blacs_mpich2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib


Could anyone tell me what lead to the problem?


Thanks,
Zhanghong Tang
0 Kudos
3 Replies
Steven_L_Intel1
Employee
900 Views
The easiest solution is to change the Fortran property "Libraries > Disable default library search rules" from Yes to No and then rebuild. You'll also want to make sure that the Runtime Library setting for the Fortran project is "Multithreaded" and not any of the other options such as "Debug Multithreaded".

Otherwise, add ifcore.lib and ifconsol.lib to the list of libraries.
0 Kudos
Zhanghong_T_
Novice
900 Views
The easiest solution is to change the Fortran property "Libraries > Disable default library search rules" from Yes to No and then rebuild. You'll also want to make sure that the Runtime Library setting for the Fortran project is "Multithreaded" and not any of the other options such as "Debug Multithreaded".

Otherwise, add ifcore.lib and ifconsol.lib to the list of libraries.

Dear Steve,

Thank you very much for your reply. I checked the fortran project and the settings of the project is just what you said. I tried to add "libifcoremt.lib ifconsol.lib" (I guess the "ifcore.lib" should be the "libifcoremt.lib"), the errors are still here.

Thanks,
Zhanghong Tang
0 Kudos
Zhanghong_T_
Novice
900 Views
The easiest solution is to change the Fortran property "Libraries > Disable default library search rules" from Yes to No and then rebuild. You'll also want to make sure that the Runtime Library setting for the Fortran project is "Multithreaded" and not any of the other options such as "Debug Multithreaded".

Otherwise, add ifcore.lib and ifconsol.lib to the list of libraries.

Dear Steve,

Thank you very much for your reply. I checked the fortran project and the settings of the project are just what you said. I tried to add "libifcoremt.lib ifconsol.lib" (I guess the "ifcore.lib" should be the "libifcoremt.lib"), the errors are still here.

Thanks,
Zhanghong Tang
0 Kudos
Reply