Switching 3rd party compilers in devenv from the command line - visual-studio-2005

We have an automated build system, which builds a variety of Visual Studio 2005 solution files. These solutions contain various Visual C++ and Intel Fortran projects.
We are in the process of upgrading our Intel Fortran compiler, and Visual Studio is currently setup to be integrated with the old Intel compiler (ver 9.1).
I'm looking for a way to tell Visual Studio to use the new Intel Fortran compiler (ver 11). I need to be able to tell Studio to do this just for our compiler upgrade project, with it's default remaining as is (using ver 9.1) so that our standard builds can continue without being affected by the upgrade project.
Does anybody know if this is possible? I.e., can I tell Visual Studio which Intel compiler to use via the command line?
At the moment, I can use the batch scripts that Intel supply to setup the LIB=, INCLUDE= and PATH= environment variables. However, when Visual Studio compiles the Fortran projects, it's using ver 9.1.

What about the "/useenv" command line to devenv.exe?
C:\>devenv /?
Microsoft (R) Visual Studio Version 8.0.50727.867.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
Use:
devenv [solutionfile | projectfile | anyfile.ext] [switches]
...
/useenv Use PATH, INCLUDE, LIBPATH, and LIB environment variables
instead of IDE paths for VC++ builds.

Related

How to make Intel Parallel in Visual Studio run .f77, .f95, etc.?

It seems that after installing Intel Parallel XE 2020 on Visual Studio 2019, I cannot run some extensions of Fortran such as .f77 and f95. It runs .f90 for example, but how can I fix it to run every extension?
What you are looking for is in Tools/Options and then Intel Compilers and IFORT/General under Sources.
Add the .f77 and .f95 extensions to the appropriate file format.

How to build windows xp application using Visual studio command line + SCons?

Building a windows xp application using Visual Studio 2015 IDE isn't hard at all, you just need to use the right platform toolset (v120_xp or v140_xp) and just make sure you install the proper redistributable visual studio runtime dlls on the target machine, easy peasy.
Now, I've been trying to figure out how to build a windows xp application targetting windows xp without using the VS GUI but using VS2015 command line + SCons
All the SCons flags are docummented here but I don't see anything that allows me to change the platform toolset.
If you wonder what's the real meaning of the platform toolset flag... after some research I've been able to figure out what that flag really does is basically producing different PE headers that are suitable for the target machine loader, you can see a little comparison between 4 different cases below (v120, v120_xp, v140, v140_xp):
Question: How can i change the visual studio platform toolset when using visual studio command line or when using visual studio command line + SCons?
EDIT: I've found this Can I set the platform toolset from the command line when building with VS2010's msbuild? but I'm not sure whether that could be used via SCons :/
After a lot of digging I've found out the best strategy to know more about the platform toolset meaning was comparing manually how this flag would affect both cl and link, I've already done that and here's my findings:
v120_xp
-------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_"
v120
----
link: /SUBSYSTEM:CONSOLE
cl:
v140_xp
--------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_" /Zc:inline
v140
-------
link: /SUBSYSTEM:CONSOLE
cl: /Zc:inline
I've extracted out all common parameters and left only the relevant ones affected by platform toolset. In order to know more about this whole subject I'd recommend you to read specially about the /SUBSYSTEM flags from official docs.
Also, the Executable/Include/Library/Exclude directories will be adjusted to use windows SDK 7.
Remaining thing is to integrate these flags with SCons, that should be easy enough, for instance, you just need to adds these flags to the nuitka environment

Compile CUDA without Visual Studio - "Cannot find compiler cl.exe in path"

I've just begun a small project in CUDA.
I need to know the following:
Is it possible to compile CUDA code without using/buying Microsoft Visual Studio?
Using Nvcc.exe I get the error "Cannot find compiler cl.exe in path".
I've tried to install a CUDA plugin for NetBeans, but it doesn't work. (with current version of NetBeans)
Platform: Windows 7
Thanks in advance.
Update
As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.
At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.
You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:
Original Answer
If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.
Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.
Or just use Visual C++ Express.
Following the previous comments I've installed Studio Express & VS2010.
This did not solve the "cl.exe not in path" problem.
I solved the problem with the error Cannot find compiler cl.exe in path, by including
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH,
before installing Windows SDK.
This question also contains valuable information.
For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.
Thank you all for your valuable help.
add this options to nvcc
nvcc x.cu <other options> -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
i use VS2012 and my cl.exe dir is here.
You have to figure out where NVIDIA GPU Computing Toolkit is installed.
In my system it's in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" Then
"Edit Environment Variables" on Windows.
Click on New...
Variable name: NVCC
Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe
Click on OK.
Use windows subsystem for linux and install ubuntu and nvcc along with gcc and g++ using the ubuntu terminal in windows (gui does not works for linux subsystem for windows). Then configure .bashrc using bash and vim/nano with a 'cd' command to your desired location as it is done in usual linux terminal (makes it easy as bash opens in system32 folder everytime). And then you can compile .cu files using nvcc over bash. As nvcc supports gcc and g++ under linux so it solves the problem. No need to sacrifice peace for switching over to linux or dealing with crappy visual studio. It worked for me.

Selecting a compiler for a make file

Say you have both VS2008 and VS 6 installed on your computer,
and you wish to write an make file that will compile some C++ code using
the VS 6.0 compiler. How can you do that? What is the way to control the selection
of the compiler outside the make file?
Thanks
I am not sure that VS 6.0 had VCVARS32.BAT but if there is VCVARS32.BAT then you need to set your environment using VCVARS32.BAT. See Building from the Command Line, "Running VCVARS32.BAT".
If you need VS 2008 than you run VCVARS32.BAT from VS 2008.
If you need VS 6.0 than you run VCVARS32.BAT from VS 6.0.
Again, I am not sure that VS 6.0 had VCVARS32.BAT so check it.
For example building Hello, World program might look like:
"D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat" && cl hello_world.cpp

Building Opensource Qt for Visual Studio 2005/2008

Does anyone have instructions on building the opensource version of Qt? Now that the repository is opened up, I'm trying to build for VS2008 but I'm getting errors when it tries to build qmake.
I found the question I'm looking to use Visual Studio to write and compile using the open source version of Qt4 but this information is out of date, and doesn't really help me. For reference, here's what happens when I try to build with configure -platform win32-msvc2008
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -Foproject.obj -W3 -nologo -O2 -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -
IC:\dev\open_source\qt\include -IC:\dev\open_source\qt\include\QtCore -IC:\dev\open_source\qt\include -IC:\dev\open_sou
rce\qt\include\QtCore -IC:\dev\open_source\qt\src\corelib\global -IC:\dev\open_source\qt\include\QtScript -IC:\dev\op
en_source\qt\mkspecs\win32-msvc2008 -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL
-DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D
QT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED -DQMAKE_OPENSOURCE_EDITION project.cpp
project.cpp
c:\dev\open_source\qt\src\corelib\tools\qstringlist.h(45) : fatal error C1083: Cannot open include file: 'QtCore/qalgori
thms.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Building qmake failed, return code 2
Well, one helpful thing is to run configure inside the Visual Studio Command Prompt. That should be available in the Visual Studio start menu group under Visual Studio Tools.
Also now when you run configure you don't have to specify target platform, because it will be set as an environment variable by the VS Command Prompt.
I got errors from configure and nmake when I did not use the VS Command Prompt, and since switching I have not had any issues.
So the simple instructions would be:
1) open VS command prompt
2) navigate to qt folder where configure.exe is located
3) configure
4) nmake
Please, ensure that you have ActiveState Perl installed
This blog article seems to have more recent information on building Qt with visual studio. Hope it helps.
Note that Nokia, as of Qt 4.6, is now providing their own open source VS builds of Qt, so it is no longer necessary to build from source yourself to do development with Visual Studio. Access their open source download page, and look for builds named (e.g.) qt-win-opensource-4.6.1-vs2008.exe.
Also, if you simply want to compile with MSVC so you can develop with the open source libraries with visual studio, I put together a project to provide "pre-built" Qt LGPL libraries with MSVC 2008.
It might be helpfull and has the advantages of taking up less space then compiling it yourself. It also provides a command prompt with all your environment variables set up for you and a link to launch Visual Studio with a Qt environment. It's called qt-msvc-installer.
What user156973 said. Install ActiveState perl and run configure again.

Resources