Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26733 Discussions

Cos, Sin, Pow Already defined in libucrtd.lib

jura__julien
Beginner
352 Views

Hi everyone,

I'm new in the Visual Fortran world and need your help. So here's the point :

I have to upgrade an old Vs6/Fortran PowerStation code base to vs2017/Visual Fortran.
I've already setup vs2017, Intel Parallel Studio 2018, recompile the sources etc ...
My Project is basically a win MFC app which link with a huge Visual Fortran static lib (.vfproj)

All runtime are properly set :
RELEASE config : c/c++ runtime = Multithread /MT - Fortran runtime : MultiThreaded
DEBUG config : c/c++ runtime = Debug Multithread /MTd - Fortran runtime : Debug Multithreaded 

In the final linking step, i encounter several error link LNK2005 xxxxx already defined in libmmt.lib

In RELEASE configuration, to fix the Linking error (cos, sin, pow already defined) i used the solution provided by Steve Lionel (last answer)
https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/276325

So i put libmmt.lib first in my additionals dependencies and everything goes fine.

In DEBUG configuration this solution is no longer working i get the following errors :

1>libucrtd.lib(acos.obj) : error LNK2005: _acos déjà défini(e) dans libmmt.lib(acos_iface_c99.obj)
1>libucrtd.lib(acos.obj) : error LNK2005: __CIacos déjà défini(e) dans libmmt.lib(acos_iface_c99.obj)
1>libucrtd.lib(cos.obj) : error LNK2005: _cos déjà défini(e) dans libmmt.lib(cos_iface_c99.obj)
1>libucrtd.lib(cos.obj) : error LNK2005: __CIcos déjà défini(e) dans libmmt.lib(cos_iface_c99.obj)
1>libucrtd.lib(sin.obj) : error LNK2005: _sin déjà défini(e) dans libmmt.lib(sin_iface_c99.obj)
1>libucrtd.lib(sin.obj) : error LNK2005: __CIsin déjà défini(e) dans libmmt.lib(sin_iface_c99.obj)
1>libucrtd.lib(pow.obj) : error LNK2005: _pow déjà défini(e) dans libmmt.lib(pow_iface_c99.obj)
1>libucrtd.lib(pow.obj) : error LNK2005: __CIpow déjà défini(e) dans libmmt.lib(pow_iface_c99.obj)
1>LINK : warning LNK4098: conflit entre la bibliothèque par défaut 'LIBCMT' et les autres bibliothèques ; utilisez /NODEFAULTLIB:library

How to fix it ?

Best regards 

0 Kudos
4 Replies
Steve_Lionel
Black Belt Retired Employee
352 Views

In the Debug configuration, replace libmmt.lib with libmmtd.lib.

jura__julien
Beginner
352 Views

Thank you Steve,

VS2017 said : unable to open libmmtd.lib.
I guess something which rely on the debug was not installed at setup time.

Is "Intel Debugger extension" enough to fix it or should i install "Intel C++ compiler" too ?

Steve_Lionel
Black Belt Retired Employee
352 Views

Sorry, I thought there was a libmmtd but there isn't. 

I suggest you try DLL linking instead - change the libraries in both Fortran and C++ to Multithread DLL. (In the Debug configuration, you can use Multithread Debug DLL but it isn't necessary.)

You don't need the "Intel Debugger Extension" - that's used when working with programs that use the Intel Xeon Phi coprocessors.

jura__julien
Beginner
352 Views

Thank you Doctor Fortran !

Debugging is now working !

Reply