Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
18 Views

Settings for Runtime Library in MSVS17 + IVF 19.0.2.190

Jump to solution

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

Accepted Solutions
Highlighted
Black Belt Retired Employee
18 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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos
3 Replies
Highlighted
Black Belt Retired Employee
19 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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos
Highlighted
New Contributor I
18 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
Highlighted
Black Belt Retired Employee
18 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)...

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos