how/where to grab compiler of msvs 2008 (32bit) compiler toolchain without installing msvs2008 [duplicate] - c++

This question already has answers here:
download and install visual studio 2008 [closed]
(6 answers)
Closed 5 years ago.
I'm relatively new-comer to developing in windows ("7") and the environment that has been set up for me is using as IDE MS Visual Studio 2015. For a new project I'll be involved in I will work with a team who have been developing in Visual Studio 2008 a 32bit application.
As I try to create the development environment using cmake and selecting as target compiler "Visual Studio 9 2008" , cmake whines that
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_CXX_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_C_COMPILER could be found.
So I would need to obtain the respective toolchain. I have no idea how to do that in windows though and google (at least with the search terms I have used) has not been very helpful.
Note: The IDE of the team is indeed old but it is not an option to ask all of them to migrate now to a newer version.
Note2: As I understand, I cannot obtain a license for "Visual Studio 2008" anymore, but even if this is not the case, I would prefer to continue using visual studio 2015 even while developing this project. Is it possible to just obtain the compiler toolchain of 2008 and integrate it somehow so that
1) cmake can find it
2) visual studio 2015 can use it

Easiest way to go would be to install Visual studio 2008 Express if you can find the installer. It is free, and you can use its compiler without using the IDE.
In cmake you can separately select target IDE version (generator) and target compilers (toolchain).
AFAIK there was no separate download just for the compilers but there were some bundles which include it and you can try your luck with them if you can't/don't want to install full VS2008 installation (cmake might have some difficulties finding this versions though).
"Microsoft Visual C++ Compiler for Python 2.7" package should contain just the compiler/libraries part of the VS 2008
"Windows SDK 6.1" and "Windows SDK 7.0" (but not "Windows SDK 7.1") include a version of the compiler which should be compatible with VS2008

Related

Error: No CMAKE_Fortran_COMPILER could be found for Visual Studio 2019 Fortran support

I am using CMAKE to build Open Source Projects (like those are available at GitHub etc.) and I also have installed Visual Studio 2019. There is a problem that CMAKE can not find Fortran compiler in my system whereas I've installed MinGW with Fortran compiler. The error is:
**The Fortran compiler identification is unknown**
**No CMAKE_Fortran_COMPILER could be found.**
How can I solve this problem and make CMAKE be aware of Fortran compiler?
Note: I tried other projects that does not require Fortran compiler and those are built successfully.
Installed software:
CMAKE 3.18.5,
Visual Studio 2019,
MinGW
You need to show where your fortran executable file to CMakeList.txt like
set(CMAKE_Fortran_COMPILER "C:/MinGW/bin/gfortran.exe")
EDIT 2 for Visual studio 2019:
If you want to produce Visual Studio 2019 solution
Download IntelĀ® oneAPI HPC Toolkit here.
If cmake cannot find Fortran compiler add a cmake flag CMAKE_Fortran_COMPILER with the value of ifort.exe path that u installed above. Like %install_path%/Intel/oneAPI/compiler/2021.1.1/windows/bin/intel64/ifort.exe
Configure and generate solution.
EDIT:
Alright, now I understand why you get this error. The Visual Studio generator does not support MinGW gfortran. They are totally separate ecosystems.
Remove your build directory and create a fresh one. Then use cmake .. -G "MinGW Makefiles" instead. I tried from CLI prompt of msys and successfully obtained the libraries from Windows machine.
If you are using Intel processors, you should first set-up Fortran environment for Visual Studio 2019
Better to check compilation guide and some troubleshooting Fortran Integration Issues with visual studio

CMake and multiple Visual Studio installations using the same compiler version

Scenario
A colleague set up a system a while back. They installed Visual Studio 15 Comminity Edition, merely to test the build process.
At some later point, another colleague was assigned to use that machine. Unbeknownst to them, there was Visual Studio 15 still installed on this machine, but since we have commercial licenses they installed Visual Studio 15 Professional in addition to the alrready installed Community Edition.
Behavior
It is of important note, that the Community Edition installation had the MFC toolset installed, while the Professional Edition installation had not.
Afterwards, the second colleague used our automated procedure to call CMake to first generate project files for Visual Studio, then used the standard command to execute the build pipeline:
cmake -G "Visual Studio 15 Win64" .
This resulted in compilation errors, because the Professional Edition did not have the MFC toolset available and thus the build pipeline failed. Yet within the IDE compilation was successful. After a short while was discovered, that opening "Visual Studio" via Windows start menu resulted in opening the Community Edition rather than the Professional Edition. Since the MFC toolset was then availale, IDE compilation was successful.
Question
Is the solution to this problem as obvious as it seems or does CMake have some way to determine which compiler to use?
Currently I have the following assumptions and would like to validate or refute them:
Each of the Visual Studio versions came with their own compiler for which the respective installers are able to enable/disable additional toolsets.
These two Visual Studio versions do not share the same comiler. (That they do not share toolsets does seem obvious)
CMake has no additional settings to declare which of the compilers of these distinct Visual Studio installations is to be used to execute the build pipeline.
The reason CMake utilized the Professional Edition compiler to execute the build pipeline is merely because the Professional version was installed second, likely overriding a path (registry entry?) CMake uses to find the compiler.
Is this assessment correct? Did something else happen here?

The build tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found

I'm trying to build project c++ on vs2017 but there error appear:
"The build tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found " after navigation, I must download VS 2008 I have installed it, but problem still exist .
any Suggestion ?
You need:
An MSVC 9.0 compiler toolchain
https://wiki.python.org/moin/WindowsCompilers lists the products that have it:
VS 2008, "Visual C++" feature and "x64 compilers and tools" subfeature
Express edition only has x86 compilers
Do install SP1 on top of VS2008 -- in vanilla VS2008 installer, installation for many features, including x64 compilers, is broken
WinSDK 6.1
WinSDK 7.0
"Visual C++ Compiler for Python 2.7" package
MsBuild 4.0 toolset configuration files for the above toolchain. (These are the directories c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\<arch>\PlatformToolsets\v90\ with .props and .targets files in them)
The only product I know that has this package is VS 2010 ("Visual C++" feature and "x64 compilers and tools" subfeature).
(WinSDK 7.1 technically has it, too, but its setup is riddled with bugs and broken on an x64 system.)
(You can bypass the buggy installer though if you install <GRMSDK_EN_DVD.iso>\Setup\vc_stdx86\vc_stdx86.msi directly. Despite the name, it has toolset files for all 3 platforms.)
"Visual C++ Compiler for Python 2.7" package is not supported by these toolset configuration files. So if you use it, you'll need to either manually specify its location in one of registry values specified in .props, or modify .props to also look in HKLM\Software\Microsoft\DevDiv\VCForPython.
The projects are targeting the v90 platform toolset. The solution is to either open the .sln file with VS2008 (i.e. use the right tool), or spend some time updating the projects to target the latest platform toolset (i.e. VS2017). To do that, just right click each project, and go to Properties, then look at General | Windows SDK Version. You may have to fix compilation / linker errors following the project upgrade.
It is possible to upgrade the project file from the command line without opening it in Visual Studio. I was running into the same issue, and found another solution in the Microsoft documentation for Visual Studio (https://learn.microsoft.com/en-us/visualstudio/ide/reference/upgrade-devenv-exe?view=vs-2017).
Here are the steps:
Open the developer command prompt for you version of Visual Studio, e.g. 'Developer Command Prompt for VS 2017'.
Navigate to the directory of your project file.
Execute the following command: devenv myproject.sln /upgrade

Trying to build a Qt application with VC++ compiler: 'type_traits': No such file or directory

Why doesn't the compiler find the file? It exists in the VC include directory for VS 14.0.
I've read that in previous versions of Visual Studio, you have had to install a service pack or something, is this a similar case?
I'm using VS 2015 Community.
This seems to be resolved by running vcvarsall.bat and starting Qt Creator from the same command prompt window.
I had this same problem in Visual Studio 2019 Community with Qt 6.0.0
after, searching every forum etc.. and trying the install of Visual Studio 2015 build tools x64 and Visual Studio redistributable 2015 x64 (which didn't solve the problem too),
I tried updating Windows sdk version from 10.0.18362.0 to 10.0.19041.0 and the problem was SOLVED.
I'm currently using Visual Studio Community 4.8.03761 if that might help others
so just check that you have Window sdk version 10 updated and that your compiler is well chosen (I had mvsc2019_64 and work with LLVM etc.. version in build settings) .
hopefully this helps you guys.

How can I get the "Visual Studio 2012" cmake generator on mac?

For a CS class I'm taking, the C++ assignments need to be submitted as Visual Studio 2012 projects. I'd really rather not use Visual Studio, so I'm thinking about creating cmake projects instead, then generating Visual Studio project files using cmake. I know this is possible using cmake -G "Visual Studio 11", but this only seems to work on Windows. When I run cmake on my computer, I get a list of generators, and the Visual Studio generators aren't listed. I know that the cmake website says that generators are platform specific, but is there some way to get these generators working on OS X?
Edit: For anyone coming across this question later, you should look into premake instead of messing with cmake. If you get premake 5, which is currently the development version, you can use it to generate Visual Studio 2012 files from Mac or Linux without needing to use Windows at all (on Windows you can generate Xcode projects without having to use OS X as well).
CMake needs to call Visual Studio compiler to check compiler version, so I doub't it could find it on OS X, that why it's platform specific.