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

ifort causing MCLS?

leoghann
Beginner
576 Views

I'm in the middle of working on a mixed C/FOTRAN project. I hope I'm not revisiting an already visited issue here, but I couldn't find any information when I searched the forums or the support site.

This thing is ported from Unix by a bunch of former mainframe guys. Seriously, they think in terms of cards and decks here. Needless to say, there's no GUI. I get to use makefiles (fun!).

Now there are some peculiar errors occurring, so I decided to build my executable in debug form, linked to the multi-threaded debug DLL versions of the C and FORTRAN libraries. Everything compiles just fine, but at link time, I get this:

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

Knowing that this is usually a quick ticket to death, I double-checked my compiler options. I'm using Visual C++ .NET 2003 and Intel Fortran 8.0.050. Stripping the include directories, the compilers receive, respectively:

cl.exe /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "FORTRANIFACE='IVF'" /RTC1 /MDd/W3 /nologo/c /Zi

ifort.exe /nologo /Zi /Od /traceback /check:bounds /libs:dll /threads /dbglibs /c

Now I've double-checked both MSDN and the Intel references, and unless I'm missing something totally obvious (quite possible), that should have worked. Both are supposed to compile to the multi-threaded debug DLL versions of the runtime libraries, right?

For the sake of completeness, I did a DUMPBIN /DIRECTIVES on two of the .OBJ files -- one from the C++ compiler and one from Fortran. The C file has these:

Linker Directives
-----------------
/DEFAULTLIB:"MSVCRTD"
/DEFAULTLIB:"OLDNAMES"

The Fortran file had these:

Linker Directives
-----------------
-defaultlib:ifconsol
-defaultlib:libifcoremdd
-defaultlib:libifportmd
-defaultlib:libmmdd
-defaultlib:MSVCRT
-defaultlib:libircmt
-defaultlib:OLDNAMES

So the C files are trying to link againstMSVCRTD, but the Fortran files are pulling inMSVCRT. Thus, the warning...

What am I missing here?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
576 Views
You're not missing anything - I can reproduce the problem and you're doing everything right. I do note that an internal development version doesn't have this problem. Lorri is our expert in this area and I imagine she will chime in when she sees this, but for now I suggest adding a /nodefaultlib:msvcrt.lib in the meantime.
0 Kudos
Steven_L_Intel1
Employee
576 Views

The issue is more complex than I first remembered..

Unless you have VS98/VC6/CVF installed on your system, you don't want to link against the ifort debug DLLs. That's because they reference MSVCRTD.DLL which is available only in the older products. Starting with VS.NET 2002, Microsoft changes the name of this DLL.

We're fixing this for the next release by making the Fortran libraries not dependent on the MS debug DLL.

So what I would suggest for now is that you not use /dbglibs and don't build against the MSVC debug libs either, unless you really have a need for that.

0 Kudos
Reply