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

Linker error from hell: LNK1112

iatel
Beginner
635 Views
Hi,

Please help me, I have gotten stuck with a problem on a 64-bit machine that has already successfully compiled lots of code for me. Suddenly, this linker error appeared and I can't make it go away.

I am on a 64-bit XP machine, using Fortran Compiler 10 from Visual Studio. I have written some code on a 32-bit laptop, and then copied it to this machine and created a new console application. I am trying to link some IMSL libraries (something I have also successfully accomplished before), and somehow this seemed to cause problems for the compiler. I finally, I thought, found the right way to add the libraries to the library list, but now I'm getting this"

""Error 1 fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' LIBCMTD.lib "

I don't know where it came from and can't seem to make it go away.

The only change between the last time I successfully built a Fortran program on this computer and now is that my hard drive crashed recently, and though through a mirrored hard drive, I recovered all of my old installed software, the files were from 6 months before the crash. Moreover, all the code that used to build with no problems now comes up with the same linker error. (But only after I test-compile one of the component files of the old programs). In other words, I must have messed up some global setting...

Please help!
Irina
0 Kudos
9 Replies
Steven_L_Intel1
Employee
635 Views
You have somehow managed to configure things so that the 32-bit C++ libraries are being looked for by the linker. Assuming that you have established the project platform as "x64", go to Tools > Options > Intel Fortran > Compilers. Select "Intel 64" as the platform type and click on the ... button next to Library Files. Copy and paste the contents into a reply here.

Note that you will also need to install the Intel 64 variant of IMSL and add the path to that in the above list. See Installing and Configuring the IMSL* Libraries for details.
0 Kudos
iatel
Beginner
635 Views
You have somehow managed to configure things so that the 32-bit C++ libraries are being looked for by the linker. Assuming that you have established the project platform as "x64", go to Tools > Options > Intel Fortran > Compilers. Select "Intel 64" as the platform type and click on the ... button next to Library Files. Copy and paste the contents into a reply here.

Note that you will also need to install the Intel 64 variant of IMSL and add the path to that in the above list. See Installing and Configuring the IMSL* Libraries for details.

I have no idea how that happened. Here is the content of the library list: I have actually tinkered with it quite a bit already, but I didn't realize that "VC" is referring to C++? What is the right correction for it? (Same links in the INCLUDE list, by the way)

$(IFortInstallDir)Lib
$(VCInstallDir)atlmfclib
$(VCInstallDir)lib
$(VCInstallDir)PlatformSDKlib
$(FrameworkSDKDir)lib
C:Program Files (x86)Microsoft Visual Studio 8VCATLMFCLIB
C:Program Files (x86)Microsoft Visual Studio 8VCLIB
C:Program Files (x86)Microsoft Visual Studio 8VCPlatformSDKlib
C:Program Files (x86)Microsoft Visual Studio 8SDKv2.0lib
C:Program Files (x86)VNIimslfnl600Intel64lib

I do have the x64 version of IMSL (as far as I understand, it's already linked, last item in the list above). Again, I have successfully linked all these things before. Not sure what happened.

Irina



0 Kudos
Steven_L_Intel1
Employee
635 Views

You want $(VCInstallDir)libamd64

The atlmfc line shouild also end in amd64. The PlatformSDK line also or x64, depending on which PSDK you have.

The FortranInstallDir line shouild end in LibIntel64

You seem to have a mix of IA-32 and x64 stuff in here. Make sure you are editing the list for Intel64.
0 Kudos
Steven_L_Intel1
Employee
635 Views
Here's what my system has for x64 (minus IMSL):

$(IFortInstallDir)libIntel64
$(IFortInstallDir)mklem64tlib
$(VCInstallDir)atlmfclibamd64
$(VCInstallDir)libamd64
$(VCInstallDir)PlatformSDKlibx64
$(WindowsSdkDir)libx64

0 Kudos
iatel
Beginner
635 Views
Here's what my system has for x64 (minus IMSL):

$(IFortInstallDir)libIntel64
$(IFortInstallDir)mklem64tlib
$(VCInstallDir)atlmfclibamd64
$(VCInstallDir)libamd64
$(VCInstallDir)PlatformSDKlibx64
$(WindowsSdkDir)libx64

Hi Steve,

Thank you so much for your help! Problem not resolved yet, but I had an inkling that this was the source, and at least I got rid of that error...

Now the error reads "Error 1 fatal error LNK1104: cannot open file 'ifconsol.lib' LINK "

I have searched for the file and found it in "C:Program Files(x86)IntelCompilerFortran10.0.026em64tLib"

1) I guess I'm wondering if this is my $(IFortInstallDir), and if so, whether the top line in the above list (and as it was in mine) is incorrectly specified? 2) How do I find out the values of these variables like $(IFortInstallDir)? 3) Hopefully final question: Should I be changing anything in my Includes and the Executables list? They are also a messy-looking bunch, though the include directories seem correctly specified (I just have the same redundancy as I did before with the folders specified both via the environmental variables and explicitly)...

I'm clearly ignorant of important details! Thanks so much for your help!!

0 Kudos
Steven_L_Intel1
Employee
635 Views
Oh, sorry, version 10. It's different for that. I suggest that you simply uninstall and reinstall the Visual Studio integration and it should set it up properly.

The variables such as $(IfortInstalldir) are defined automatically by the VS integration and you can't change them. They are derived from the install path when you installed the product.
0 Kudos
iatel
Beginner
635 Views
Oh, sorry, version 10. It's different for that. I suggest that you simply uninstall and reinstall the Visual Studio integration and it should set it up properly.

The variables such as $(IfortInstalldir) are defined automatically by the VS integration and you can't change them. They are derived from the install path when you installed the product.

Do you mean uninstall/reinstall just Visual Studio software - all of it - or just a component?

Scary thought....
0 Kudos
iatel
Beginner
635 Views
Oh, sorry, version 10. It's different for that. I suggest that you simply uninstall and reinstall the Visual Studio integration and it should set it up properly.

The variables such as $(IfortInstalldir) are defined automatically by the VS integration and you can't change them. They are derived from the install path when you installed the product.

I just hit the reset button on the library list (as well as includes) and the application built.....

Thank you very much for your help!!

Irina
0 Kudos
Steven_L_Intel1
Employee
635 Views
Oh yeah - forgot about the Reset button! Glad you figured it out.

I had meant reinstall the Intel Fortran Compiler Integration into Microsoft Visual Studio.
0 Kudos
Reply