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

Settings for Runtime Library in MSVS17 + IVF 19.0.2.190

avinashs
New Contributor I
504 Views

If a project is compiled in MSVS under the Debug configuration with the setting for runtime library as 
    (a) Multithreaded
    (b) Debug Multithreaded
then the difference in the compile command of (a) vs (b) is
    (a) /libs:static /threads
    (b) /libs:static /threads /dbglibs

My questions are:

(1) What is the difference between these two options?
(2) Would the fact that they are both under the Debug configuration render them the same?
(3) What is the default option for IVF?
(4) Using a library generated with option (b) that is subsequently linked in another project with the option (a) generates the warning:
        LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
    Is this warning OK to ignore?

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
504 Views

(1) /dbglibs causes the debug versions of the Microsoft Visual C++ libraries to be referenced. These have some different behaviors in added correctness checking for allocations and more.

(2) No.

(3) The default is /dbglibs for a Debug configuration, and the non-debug libraries for a Release configuration

(3) No, it is not safe to ignore and can cause difficult-to-diagnose problems. My advice is to change your library project property Fortran > Libraries > Disable default library search rules to Yes. This means that the static library objects themselves will not request any particular run-time libraries, relying on the executable project to do so. If the executable is also Fortran, that's all you need. If the executable is C++, then you'll have to name the necessary Fortran libraries (ifcoremd, etc.) in the C++ project's "Additional dependencies" linker property.

View solution in original post

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
505 Views

(1) /dbglibs causes the debug versions of the Microsoft Visual C++ libraries to be referenced. These have some different behaviors in added correctness checking for allocations and more.

(2) No.

(3) The default is /dbglibs for a Debug configuration, and the non-debug libraries for a Release configuration

(3) No, it is not safe to ignore and can cause difficult-to-diagnose problems. My advice is to change your library project property Fortran > Libraries > Disable default library search rules to Yes. This means that the static library objects themselves will not request any particular run-time libraries, relying on the executable project to do so. If the executable is also Fortran, that's all you need. If the executable is C++, then you'll have to name the necessary Fortran libraries (ifcoremd, etc.) in the C++ project's "Additional dependencies" linker property.

0 Kudos
avinashs
New Contributor I
504 Views

Steve Lionel (Ret.) wrote:

(1) /dbglibs causes the debug versions of the Microsoft Visual C++ libraries to be referenced. These have some different behaviors in added correctness checking for allocations and more.

(2) No.

(3) The default is /dbglibs for a Debug configuration, and the non-debug libraries for a Release configuration

(3) No, it is not safe to ignore and can cause difficult-to-diagnose problems. My advice is to change your library project property Fortran > Libraries > Disable default library search rules to Yes. This means that the static library objects themselves will not request any particular run-time libraries, relying on the executable project to do so. If the executable is also Fortran, that's all you need. If the executable is C++, then you'll have to name the necessary Fortran libraries (ifcoremd, etc.) in the C++ project's "Additional dependencies" linker property.

Thanks. This is helpful, especially (2) and (4). So the fact that you chose a Debug configuration does not imply the same properties. Also, finally understood what disable default library search rules means. Will make the appropriate changes.

0 Kudos
Steve_Lionel
Honored Contributor III
504 Views

I should add that even though Intel Fortran provides "debug" libraries of its own (libifcoremdd, libifcorertd, etc.) these are the same as the "non-debug" versions. The difference is in the MSVC libraries. If you have any C++ code, though, you must be sure to link with the correct set of libraries as the C++ compiler generates different code depending on whether you are using debug libraries or not.

And of course I meant to number the last one (4)...

0 Kudos
Reply