CMake 64bit windows generator not working - visual-studio

I wish to generate a x64 project for Visual Studio with cmake. Unfortunately, cmake always generates x86 projects. The generator name I use is "Visual Studio 12 Win64". cmake is run from x64 VS developer console, yet still projects are generated for x86 and CMAKE_SIZEOF_VOID_P is always 4, not 8. There are no errors during project generation. Could this be a bug in cmake?

For me determining the the size of a void pointer with cmake started to fail after I switched the MSBuild project output in Visual Studio 2010 from "Normal" to "Diagnostic". Everything worked fine again after switching back to "Normal".

Related

Compilation Error in VS Studio compiling Fortran code

I am getting this error while compiling my Fortran code in VS Studio:
warning #31001: The dll for reading and writing the pdb (for example, mspdb110.dll) could not be found on your path.
I also looked to change the Base Platform Toolset in Project Properties, but in VS 2019 IDE I couldn't find this option to edit it.
I am using Intel Compiler 2021. I have also tried upgrading my VS Studio to latest version but the problem persists.
Please tell how to fix this.
This message is saying that your Visual Studio is misconfigured. Make sure that you have the "Desktop Development for C++" and "Windows 10 SDK" components of Visual Studio installed (see https://www.intel.com/content/www/us/en/developer/articles/guide/installing-microsoft-visual-studio-2019-for-use-with-intel-compilers.html) You may need to uninstall both the Intel compiler and Visual Studio, then reinstall.

Visual studio 2019 forces x64 and changes project/solution files unasekd

I have a cmake project (cmake 3.19.0-rc1) that I want to build using Visual Studio 2019 (Microsoft Visual Studio Community 2019 Version 16.7.6). There are no toolchain files in the project.
The solution and project files are created via
cmake -G "Visual Studio 16 2019" -A Win32
The solution is created successfully with the Win32 target platform. The first build works as expected.
However after that, Visual studio informs me that the project and solution file has changed outside of the IDE and that they need to be reloaded. After that the target platform is x64.
I can manually re-add the Win32 target platform, but with every compilation, visual studio resets the target platform to x64.
How can I stop this behavior and just stick with the Win32 platform?
Apparently it was a Visual Studio extension (Clang Power Tools) that decided it needs to edit the stamp files. This caused a recreation after the build process.
The problem was solved by deactivating and deinstalling the Clang Power Tools extension.

Use the 64-bit Visual C++ Toolset in Visual Studio 2017

My (quite large) C++ project has grown to a point where I get a C1060: compiler is out of heap space error when trying to compile my project.
I'm compiling on a 64-bit Windows 10 machine, but it seems that Visual Studio is compiling my project with the 32-bit toolset (see screenshot below).
The C1060 help page asks me to use the 64-bit toolset, but the link provided talks about how to enable it when compiling with the command line only.
Is there any way to set project properties or something else in Visual Studio 2017 to tell it to use the 64-bit compiler toolset (which is already installed on my machine)?
This is how I made Visual Studio 2017 use the x64 toolset, as per this answer:
Open the .vcxproj file with your favourite text editor, find this line:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Then add this immediately after it:
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
That answer was for Visual Studio 2013 but it works for 2017 too.
Additional Note: However, it turns out this didn't actually solve my problem. The 64-bit toolset ate up all the memory on my machine and forced me to need to reboot. When I rolled back the latest changes to the code, it compiles using ~2.8GB for the 32-bit compiler, and compiles using ~4.2GB for the 64-bit compiler (the latest code consumed ~6.4GB before freezing my task manager on my 8GB machine). I'll be looking through the new code and attempting to figure out why so much more memory was needed.

Debugging information does not match, when using v60 platform toolset inside Visual Studio 2013

I am using Visual Studio 2013, but I'm in need to develop an old project using the Visual C++ 6.0 compiler.
For this purpose, I have been using Daffodil with no problem on Windows 8.1 for a while.
(You can read more how to use the VC++ 6 compiler in newer Visual Studio versions in this StackOverflow question: Is it possible to use the VC++ 6 compiler in Visual Studio 2012?)
Now I got a new Windows 10 machine, where I reinstalled Visual Studio 6, 2010, 2013 and Daffodil.
Using v60 build tools (Visual C++ 6.0 compiler), project gets compiled fine.
However, when I try to debug, VS says that "debugging information does not match", and I am unable to set breakpoints etc., but:
PDB file is there, same folder and name of debug executable;
Application built in Debug mode, with debug information enabled;
Debugger works fine when using Visual Studio 2010 or 2013 build tools;
Debugger works fine if opening the project inside Visual C++ 6 IDE.
I tried reinstalling all Visual Studio versions as well as Daffodil, but didn't solve.
Any clue what could the problem be?
Finally I actually found a working solution!
for VS 2013:
Enable "Native Edit and Continue"
under Tools->Options->Debugging->Edit and Continue
for VS 2015:
Enable "Use Native Compatibility Mode"
under Tools->Options->Debugging->General

Unable to build C++/CLI app using VS 2010, .Net 3.5, and 64-bit

I have a C++/CLI app that is built under Visual Studio 2010 but using .Net 3.5. As required, I hand edited my project file to add the TargetFrameworkVersion with a value of 3.5 and was able to build it without issue when I was in x86 (32-bit) mode. However, when I switched to build it in x64 (64-bit) mode, I got the following error:
error MSB8014: Execution path (C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64) could not be found.
I do have VS 2008 (9.0) installed, but there is no x86_amd64 directory under the bin folder. I tried fooling it by adding this folder (and the amd64 folder which would have failed thanks to the next line in the targets file), and then I got the error:
fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
which I can't figure out because my project has no explicit links. I switched the C# assemblies that it interacts with to build in x64 (as opposed to any CPU) but to no avail.
FYI: Everything builds correctly in 32-bit mode. Everything also build correctly in 64 bit mode if I switch to .Net 4.0 (v100). I get the same errors building in both release and debug mode.
Any ideas would be appreciated.
If you are compiling with the "toolset" changed over from V100 to V90 on the project properties, and you have Visual Studio 2008 installed on the same development machine, just go to Control Panel, Programs and Features, select Visual Studio 2008, right-click, select Uninstall/Change, then select to add/remove f eatures, then when you are presented with a list of features, look for x64 compiler/files under Visual C++ which is not installed by default,but by clicking on the checkbox next to it, it will add the needed files.
In VS2010 it should link to C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64
You probably got configuration wrong, or imported from a vs2008 project.
Go to Configuration -> General -> Platform Toolset. make sure it's v100 (vs2010)
If that doesn't help , look at Configuration -> VC++ Directories. That's where that path is set.
You can see that it looks in $(VCInstallDir) which in your computer is set to the VS2008 path.

Resources