ifort: error #10037: could not find 'link' - linker

I downloaded and installed evaluation software of:
Intel Parallel Studio XE Professional Edition for Fortran Windows. My system is a 64 bit, Windows 7 OS. During its installation I was asked to download and install also: Microsoft Visual C++ 2013 Redistributable(x64)- 12.0.21005 .
I am trying to compile my source files using the command line.
In order for the command ifort to be recognized, I added the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64
to the PATH environment variable . (This folder contains the file ifort.exe).
However, when I try to compile a simple 'Hello World' program by the command:
ifort hello.for
I get the error:
ifort: error #10037: could not find 'link'
The file 'hello.obj' , however, was created.
The steps I tried in order to fix this error (but that made no difference):
1) I tried to add to the PATH environment variable the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64_gfx
This folder contains the file: gfx_linker.exe, which I thought is the needed linker.
2) I tried to change the configuration of Visual Studio to add 64-bit support, according to the 4 steps Steve Lionel (Intel) sugested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/300121), but the window that appeared (after pressing the change option in the 'Uninstall or change a program utility' of the control panel) showed no 'x64 compiler&tools' checkbox option, only a repair button option, which made no difference.
3) I tried to update the ifort installation, as Tim Prince suggested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/280266). I tried to do it through the 'Uninstall or change a program utility' in the control panel. But selecting the 'Repair' option in the window that appeared blocked the completion of the process by stating that 'repair cannot be done because no available sources were found', and selecting the 'Modify' option, blocked me in the step of 'selecting components to modify' (nothing I chose enabled the 'next' button).
4) Before calling ifort I tried to execute the cammand:
"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bincompilervars.bat" intel64 vs2013
as Steve Lionel (Intel) suggested in the previous link, but got the error:
ERROR: Visual Studio 2013 is not found in the system.
Right now I'm out of options, and beg for help to show me how to fix this error of ifort not being able to find the 'link'.

You can simply compile your Fortran files from command line using ifort, to do that:
Start menu > programs > Intel parallel studio XE 2O16 > Intel 64 visual studio mode or search for Intel 64 in the start menu
open Intel 64 visual studio mode . Now you can start to use ifort and it will work fine.
If you want to know how to invoke it (the parameters used) then right click over Intel 64 visual mode, from the menu choose open file location.
I uploaded these screenshots, just take a look:
From the second screenshot notice the parameters passed to the batch file.
Note: according to Intel documentation the second argument (vs2013) is optional.

My friend got the same problem. Here was what I advise him to do and it worked. The reason why this happened is that you missed link.exe located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\ and other related folders too. So, you can use a small software called everything to search your computer to find out whether the link.exe is missing in your Microsoft Visual Studio folder. If it is the case, you can copy these files from someone else or just reinstall your visual studio and make sure everything is right in place.

I had the same issue.
First of all add "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin" to path.
Now, from windows command line run: compilervars.bat intel64
It sets up the environment on the windows command line.
now you can access the "ifort" commands without getting the linking errors.

I'm going to start by pointing out the required steps needed for code to metamorphose into executables: [SO]: LNK2005 Error in CLR Windows Form (#CristiFati's answer). That's for C, for Fortran it's the same thing, except:
Step #1. does not exist (at least, I don't think so)
Step #2. will be performed (obviously) by the Fortran compiler
Ran into the same issue when working on [SO]: What is numpy.ctypeslib.as_ctypes exacty doing (#CristiFati's answer). Environment:
Intel's oneAPI HPC Toolkit (also Base - which is a direct dependency) for ifort.exe
Microsoft's Visual Studio (I have many versions installed, chosen v2019 as it was the newest at the time) for link.exe
As seen (one has to look in both Output snippets) I built it manually in 2 steps.
But ifort.exe can automatically invoke link.exe, if the latter's dir is in the PATH variable. For more details on invoking VStudio commands, check [MS.Learn]: Building on the Command Line.

Related

How to use VC++ compiler in command line(Windows)?

I tried to use VC++ commandline, instead of MinGW compiler for windows system programming. I wrote a simple hello world program and tried to compile it, then i got this error message.
test2.c(1): fatal error C1083:'stdio.h': No such file or directory
I also added "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx86\x86" directory (where c1.dll lives) to the System Envionment Variable(PATH).
How can I fix this issue? Other tutorials don't give much information about VC++. (A lot of MinGW compiler tutorial out there btw)
You should use visual studio command line if you want to compile or run program with the help of vc++ compiler.
Else all information related to setting environment variables ETC. resides in this MSDN document.

New to C: Compiling in Visual Studio Code... error: gcc not recognized?

I am very new to coding (trying to teach myself C). I have some experience with MatLab, but I understand it is very different from C. I have Windows 10 with the newest version of Visual Studio Code (VSC) with the Run Code Extension and git extension (not sure what git does, but VSC prompted me to install). I am now familiar with the text editor, but do not know how to compile/run my code (apologies if I'm butchering the terminology, again, a newby). One friend recommended I determine the location in which the desired text file is located, type "gcc filename.c", enter, type "./a.out", and then the program should run. (Said friend has a Mac and I supposed the execution commands are different?) Regardless, I encountered "Run Code" extension on my google adventures and follow the steps I've seen online, but I am still getting the error pictured.
I can see how this would be an especially basic question, but if anyone can offer assistance/advice, I would be extremely grateful!
Thanks, All.
Sandy
P.S. In case the image doesn't load/work for whatever reason, this is the error:
"'gcc' is not recognized as an internal or external command,
operable program or batch file."
Works perfect in Visual Code. You need the following:
C/C++ extension in Visual Code.
msys64 installed in C:\
Add path to msys64 bin folder in environment variable
Instructions:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
Important the msys64 path doesn't contain spaces so don't install it in Program Files.
You can search "Edit system environment variables" from the windows button, press button Environment Variables, and then add it as a System variable "Path". For me its located in
C:\msys64\mingw64\bin
Hey,,,
It will work for you I believe
Blockquote
First: open the link: https://www.msys2.org/
Go to the installation and download the installer .. install the exe file.
search mingw in windows search(windows start)
there is an app named--> MSYS2 MinGW {64/32}-bit
run it as administrator
Found command shell ---> type: pacman -Syu
Will ask you for some installation click on Y
Then again go to the same app MSYS2 MinGW {64/32}-bit and run as admin
and write--> pacman -Ss gcc (in shell that opend after click)
after clicking there will be bunch of things and now you have to care about your windows arch.. if it is 64 bit then write---> pacman -S mingw-w64-x86_64-gcc (and if its 32 you will find something like that where 64 will replaced by 32 in bunch of commands that are showing in your shell)
after executing this command gcc will be installed in your system to check write: gcc --version || g++ --version
After that to install the debugger write pacman -S mingw-w64-x86_64-gdb
to check write: gdb --version
**Every thing got installed in your system now find the mingW file or mysys2 file on C drive(whereever you r mingW file got saved) go the the minGW 64 || 32 accroding to your operating system there is a bin folder click on that and copy the path inside the bin folder and save it in environment variables path **
Blockquote
Enjoy vs code
My recommendation
You are on Windows right? So you can just install Visual Studio IDE (follow this tutorial). Which is better than vs code. This tutorial is for C++ but it works for C as well. Because C++ uses the same compiler as C but with some more things(simple explanation).
The solution for your problem
You are getting the massage 'gcc' is not recognized as an internal or external command, operable program or batch file because you do not have the gcc compiler installed on your computer. But if you want to install it, you can follow this tutorial. But I highly recommend you use Visual Studio IDE which I mentioned above.
Type gcc --version in the command prompt to check whether the C compiler is installed in your machine.
If it is installed then try adding gcc to the environment variables using this link:
https://www.youtube.com/watch?v=qLh84CmdBJ0
If it is not installed then install it using instructions using this link:
https://www.guru99.com/c-gcc-install.html
and then add it to the environment variables using the link above.
If it is installed and not recognized by VSCode then try to run VSCode from CMD by typing code in CMD.

GTK Linker Issue Visual Studio C Project

it is the third day that I am trying to set up the visual studio 2013 with the GTK libraries. I need to use VS: I've used GCC (both command line and with code blocks) in the past (both on windows and slackware linux too..), but now I have a lot of projects in VS and I want to start making some GUI for them. After seeing that the so called "all-in-one-bundle" is not more available/maintained in the GTK website, I followed a bunch of tutorials (including GTK+ 3.0 setup in Visual Studio 2013, How to configure gtk on Visual studio 2010, How do you install GTK+ 3.0 on Windows?) and I started to install MSYS2 according to this one: https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtk-application-on-windows/.
Maybe the problem is here: I followed this step properly pacman -S mingw-w64-x86_64-toolchain, but I skipped the creation of PKGBUILD file and successive installation due to the fact that I did not understand the procedure. Furthermore the mingw toolchaing seemed to be already installed.
Sorry for the big introduction, I wanted to be specific.
The problem is at the linking-stage of Visual Studio C Project building. I had also some problem at compilation involving the different inline interpretation of VS (added #define inline __inline // Necessary to make the GTK library Visual Studio compatible definition before calling the GTK header). The linking stage issue consist in the fact that, using pkg-config --libs gtk+-3.0 --msvc-syntax command, I receive a list of files (/libpath:C:/msys64/mingw64/lib gtk-3.lib gdk-3.lib gdi32.lib imm32.lib shell32.lib ole32.lib -Wl,-luuid winmm.lib dwmapi.lib z.lib pangowin32-1.0.lib pangocairo-1.0.lib pango-1.0.lib atk-1.0.lib cairo-gobject.lib cairo.lib gdk_pixbuf-2.0.lib gio-2.0.lib gobject-2.0.lib glib-2.0.lib intl.lib) that does not exists in the msys2 directory. As a consequence I receive this error from the linker: error LNK1104: cannot open file 'gtk-3.lib'.
Someone has the same problem (see Error 3 error LNK1104: cannot open file 'gtk-3.lib'), but the solution is to use the all-in-one-bundle.
What shall I do? Have I followed the correct procedure or am I missing something? I've also tried to link to VS the *.a files located in the lib directory of mingw63 (e.g. libgtk-3.dll.a), but the linker error remains.
Best Regards and thank you for the attention
Davide

Can ARM desktop programs be built using visual studio 2012?

I was working with visual studio 2012 beta and my desktop (win32) program compiled fine in ARM architecture.
After upgrading to visual studio 2012 RC, the compiler would not work and spews out the following error:
"Compiling Desktop applications for the ARM platform is not supported"
I found a forum post on this
http://connect.microsoft.com/VisualStudio/feedback/details/745580/arm-configuration-doesnt-work
Is it correct that Microsoft is really cutting off win32 development on ARM?
And that compiling in VS2012 beta was just a fluke?
You can edit the file:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\ARM\Microsoft.Cpp.ARM.Common.props
In the <PropertyGroup> section add the line:
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
before </PropertyGroup>
And that's all, you can build ARM desktop apps with VS2012.
I was able to get around that error and compile a little "hello world" cpp file for ARM by adding the "/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE" command-line argument to the ARM version of cl at C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm. I found that #define from sn0w's answer on this question in the crtdefs.h file, without having to modify that file. Now, I can't guarantee that anything more complex will actually work, or that Microsoft hasn't instituted some sort of whitelisting or digital signature verification for Windows RT desktop apps, so even though it may compile, it may not be allowed to run when Windows RT is finally available.
Note that before you can run the ARM version of cl.exe from the command line, you must set the environment variables using this batch file: "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
Even if you compile the app, you won't be able to run it on Windows 8 RT as unsigned apps will not start.
I just tested this, and unfortunately it is the case.
You receive the following message:
Windows cannot verify the digital signature of this file
I imagine there is probably a work around for this, but it will never be officially supported.
yes of course. i practised with VS2012 RC.
now i'll explain how to avoid "Compiling Desktop applications for the ARM platform is not supported" and build win32 application.
1st way: fix build tools - the goal is to patch (or try to substitute it with beta's one) MSBuild's lib: Microsoft.Build.CPPTasks.Common.v110.dll
2nd way: run the "VS2012 ARM Cross Tools Command Prompt" from Visual Studio Tools start menu, then execute cl [cl params] myfile1.cpp myfile2.cpp myres.res ... /link [linkparams]
for both this cases you also need to commentout an #error directive in crtdefs.h on line 332. (Microsoft Visual Studio 11.0\VC\include)

Error - Compiling Gnuplot on Windows 7 using nmake and makefile.nt

Gnuplot experts or anyone who is willing to help me - I have explained what I have done in very simple words and in a detailed manner. Thanks for your time and patience in advance.
My aim is to develop a new feature in Gnuplot by adding a new terminal to it. I did the following steps in the order mentioned
I formatted my system and reinstalled Windows 7. (no antivirus installed)
Installed Visual Studio 2008
Downloaded the source code of Gnuplot
Now, am supposed to set up the compiling environment for Gnuplot in Windows. So, I did the following steps as per the instructions in "README" and "INSTALL" files in the source code package.
Opened up Visual Studio 2008 Command Prompt
changed directory to the "src" folder in the source code
Then I ran the nmake tool (the make tool meant for Visual Studio) using the file makefile.nt (which is for Windows)
nmake -f C:\Users.........\config\makefile.nt
It compiled successfully and gave the wgnuplot.exe and gnuplot.exe files as output. Also the manifest files were created. (Note: I have not changed any piece of code from the original source code package)
When I tried to open the exe file generated from the compilation, it threw me this error
The program can't start because MSVCR90.DLL is missing from your computer. Try re-installing the program to fix this problem.
This MSVCR90.dll should be installed already when Visual Studio was installed. I checked the C:\Windows\winsxs\x86_microsoft.vc90... folder and the MSVCR90.DLL was alread there. Then, I tried 2 things to solve this -
Anything to do with PATH variable? I made the PATH variable point to that directory. It threw me a new error that says
Microsoft Visual C++ Library. Run time error. R6034. Here is the detailed picture of the error
So, I reset my path variable back to the old value and followed the steps in THIS FORUM POST to fix the missing dll problem by copying the dll files to the C:\Windows\system32 folder. Again it threw me the same run time error
AM STUCK AT THIS POINT. Please advise me on how to rectify this
problem. THANKS A MILLION :) Advance thanks to you :)
Is there any reason you need to use VS2008?
If not I'd recommend to use the current VC release.
Your problem looks like some sort of version mismatch/incompablilty issue to me ...

Resources