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

LINK : fatal error LNK1181

O_Zolotov
Beginner
2,289 Views
Dear all,
I've installed Intel Visual Fortran Compiler XE v 1.2.1.3.300.

MS Visual Studio is not installed.
I tried to compile src from command line and got the following results:
-Generation of obj-file is ok.
-An attempt to create executable (/link option) produce the error:
LINK : fatal error LNK1181: cannot open input file 'file-name'
where file-name correspond to the first file name in the command line with exe extention (i.e., it corresponds to the output file name).

Is it possible to use the compiler without MS Visual Studio? (The program I write utilises console and has no GUI by design).
0 Kudos
8 Replies
Steven_L_Intel1
Employee
2,289 Views
The Intel Fortran compiler can be used from the command line but it requires the tools and libraries from Visual C++. However, the link error you are seeing has a much simpler cause, but it's difficult to give details because you don't show the link command. /link is not a "create executable" option - it simply separates compiler options from link options on the ifort command line.

Please show the exact command line(s) you are using and the exact error message you are seeing. It would also be helpful for you to show how you are starting the command line session and show the output, if any, that is displayed when the command window is opened.
0 Kudos
O_Zolotov
Beginner
2,289 Views
I tried to compile HWM-2007 model ( ftp://nssdcftp.gsfc.nasa.gov/models/atmospheric/hwm07/HWM07_all_files.zip ) under WinXP.
The compile line
ifort checkhwm07.f90 hwm07e.f90 dwm07b.f90 apexcord.f90 -o checkhwm

caused error

C:\tmp\HWM07>ifort checkhwm07.f90 hwm07e.f90 dwm07b.f90 apexcord.f90 -o checkhwm

Intel Visual Fortran Compiler XE for applications running on IA-32, Version 1
2.1.3.300 Build 20120130
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

checkhwm07.f90(191): remark #8290: Recommended relationship between field width
'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+3'.

print '(a5,f4.1, a5,f3.1)', 'MLT=',mlt, ', Kp=',kp
-----------------------^
checkhwm07.f90(205): remark #8290: Recommended relationship between field width
'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+3'.

print '(a6,f5.1, a5,f3.1)', 'MLAT=',mlat, ', Kp=',kp
-----------------------^
Microsoft 32-Bit Incremental Linker Version 3.00.5270
Copyright (C) Microsoft Corp 1992-1995. All rights reserved.

-out:checkhwm.exe
-subsystem:console
checkhwm07.obj
hwm07e.obj
dwm07b.obj
apexcord.obj
LINK : fatal error LNK1181: cannot open input file "-out:checkhwm.exe"

C:\tmp\HWM07>

0 Kudos
Les_Neilson
Valued Contributor II
2,289 Views
The "errors" in checkwm07.f90 are in fact just warnings.
The error is occuring at the link step.
Wheredothe unusual characters before the -out: come from? They would appearto be the cause of the problem.
I downloaded the source and created a Visual Studio solution. The code compiled ok (IVF 11.1.065 with the warnings above when f2003 standard checking was on). The program linked and ran to completion creating the numbers expected as shown in the code checkhwm07.f90

Les
0 Kudos
O_Zolotov
Beginner
2,289 Views
Dear Les,
I see the unusual characters but I do not have idea on their origin. Such characters does not present in any command.

Does anyone know the path of the ifort linker? (It looks like 'alien' linker call).

UPD:
It used linker from FPS4.0 installed. Does ifort has its own linker? And how to instruct ifort to use his (not FPS4's) linker?
0 Kudos
mecej4
Honored Contributor III
2,289 Views
Check the file ifort.cfg in the compiler BIN directory. It is a text file, but editing it with, e.g., Word can introduce those 'unusual' characters. You may need to turn on 'show control characters' or something similar in your editor to see those characters.

The linker is in the Visual C components directories. For example, on my system,

T:\lang\HWM07>which link.exe
/cygdrive/c/LANG/VS10/VC/Bin/link.exe

shows that link.exe is in C:\LANG\VS10\VC\Bin.

It is not a good idea to attempt to use the older linker that came with FPS4.0 with objects and libraries produced by IFort 11 or 12. The old linker will probably fail to recognize all the sections in recent object files.
0 Kudos
O_Zolotov
Beginner
2,289 Views
The file ifort.cfg is empty, i.e. it contains only commented out line
# This Configuration file may be used for additional switches

So, do I correctly understand that ifort relies on linker from Visual C distribution?
0 Kudos
mecej4
Honored Contributor III
2,289 Views
> So, do I correctly understand that ifort relies on linker from Visual C distribution?

Yes. And on other tools and resources such as the library manager, EXE dumper and SDK libraries.

The linker has a "verbose" option which may help you to track down the origin of those extra characters.
0 Kudos
Steven_L_Intel1
Employee
2,289 Views
How did you start the command line environment where you issued the ifort command? You should have used one of the "Command Line" shortcuts installed in the Start menu under Intel Parallel Studio XE. That you are getting the PowerStation linker tells me that you have not done this and are relying on the system PATH variable - either that or you do not have the required Microsoft tools properly installed. The Fortran install would provide these if you chose the download that includes Visual Studio Shell.

I would suggest first making sure that the correct Microsoft tools are there - either from Visual C++ 2005,2008,2010 or from the Visual Studio 2010 Shell installed by Intel Fortran. Please show the output from when you first open the command prompt.
0 Kudos
Reply