Linker Issue

Linker Issue

I am currently using an evaluation copy of Intel Visual Fortran 2013.  I have been trying to compile from the command line  a simple hello world application but am encountering problems with the linker.  Initially when I used the command

ifort test.for  it came back with the linker error LNK1104: Cannot open file 'ifconsol.lib'  I found in one forum post a fix which suggested using the command

ifort test.for /link /libpath:"C:\Program Files (x86)\Intel\Composer XE\compiler\lib\ia32" 

but that just resulted in another linker error LNK1104: Cannot open file 'kernel32.lib'

Kernel32.lib does exist in the folder C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib and that folder is in the system path so I don't know what is going on here.  

Any help would be greatly appecriated.



5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

There are three environmental variables used by IFORT, each of which contains a list of paths. These are %INCLUDE%, %LIB% and %PATH%. All three have to point to the right places for compiling and linking to succeed.

%INCLUDE% is used to locate header/include/module files, %LIB% is used by the linker to find LIB files, and %PATH% is used during execution.

Even though a certain directory may contain LIB and DLL files, having that directory in %PATH% does not make the linker search for libraries there, as you appear to believe.

Normally, if you open a command prompt using the shortcut dedicated to IFort, these variables are all set up properly. If you added Windows SDK components after installing IFORT, you need to go back and update the environment.

Since you have the evaluation version, you would have had to separately obtain and install Microsoft Visual Studio (such as from a free trial of VS2012.)  As mecej4 says, if you use the provided command prompt shortcut (Starr > All Programs > Intel Parallel Studio XE 2013 > Command Prompt > Parallel Studio XE with Intel Compiler XE), then the paths get set up for you. Or you can invoke the compilervars.bat file in the compiler's bin folder with an argument of ia32 or intel64, depending on whether you want 32-bit or 64-bit applications.

Let us know if this doesn't help.

Retired 12/31/2016


Thanks for the comments.

I'm pleased to say I finally managed to get it to link by running compilervars.bat.  Before that I tried editing the LIB and INCLUDE environmental variables but still got the  LNK1104: Cannot open file 'kernel32.lib' error.

Also trying to compile the file from the Intel Composer XE 2013 IA32 command prompt results in a different error, namely

error: cannot open file test.obj for write  compilation aborted for c:\users\ed\test.for (code 1)

I'm not sure why those approaches didn't work but at least I now have a fix and can go on and learn more about the compiler and its features, especially the math libraries.

Thanks again.



error: cannot open file test.obj for write compilation aborted for c:\users\ed\test.for (code 1)

This is probably the result of attempting to run the compiler when the current working directory is not one for which you have write permission. Possibly, it could be the compiler's BIN directory.

Please check your permissions for the working directory, or start afresh in a directory which you know you have full access to.

Leave a Comment

Please sign in to add a comment. Not a member? Join today