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

Unresolved Externals when I Switch to Runtime Library=Multithreaded

schulzey
New Contributor I
1,433 Views

I am trying to statically link the MKL libraries into my application by setting Fortran => Libraries => Runtime Library = "Multithreaded" in Windows Fortran XE Pro 17.0 Update 2 with VS2015. In the 32-bit version I get the following:

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

followed by:

MSVCRT.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4.

If I switch to Fortran => Libraries => Runtime Library = "Multithread DLL" and don't change anything else then it works fine. The 64-bit version works fine with either "Multithread DLL" or "Multithreaded" and so it is just a 32-bit problem. If I use /NODEFAULTLIB:library​ (as suggested in the first error message) then I get a whole lot of other unresolved externals.

​I have attached the vfproj and BuildLog files for both the Multithread DLL and Multithreaded versions. Just look at the 32-bit Release settings in the vfproj. What am I doing wrong?
 

0 Kudos
5 Replies
schulzey
New Contributor I
1,433 Views

The first error was actually libucrt.lib(log10.obj) : error LNK2005: _log10 already defined in libmmd.lib(libmmd.dll)​

0 Kudos
Xiaoping_D_Intel
Employee
1,433 Views

Your project depends on two additional libraries: "FortranLib.Lib PlateLib.Lib". If they were generated by Intel Fortran compiler did you set the same runtime library type for them?

 

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos
schulzey
New Contributor I
1,433 Views

Xiaoping, I had FortranLib.lib and PlateLib.lib set to Multithreaded DLL (different to the main application) because I thought since they are just libraries their runtime library setting wouldn't matter. I have changed them to match the main application and it now works!! Thanks.

​I just have one more question - In the main application (SGSolver) library settings I have set /winapp and /Qmkl:parallel. Should I be using these same settings in FortranLib.lib and PlateLib.lib too or doesn't it matter?

​Peter

0 Kudos
Xiaoping_D_Intel
Employee
1,433 Views

schulzey wrote:

​I just have one more question - In the main application (SGSolver) library settings I have set /winapp and /Qmkl:parallel. Should I be using these same settings in FortranLib.lib and PlateLib.lib too or doesn't it matter?

​Peter

Both options will let compiler add directives to the generated object files so that some specific libraries can be linked without being explicitly provided to the linkage command line.

If the main application project has already set them you don't need set them again in FortranLib.lib and PlateLib.lib.

 

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos
schulzey
New Contributor I
1,433 Views

Thanks Xiaoping, problem solved!

0 Kudos
Reply