c++visual-studiobuildconfigurationmlpackvssettings

Can I set a default "Active Solution Platform" in Visual Studio?


The Question

In Visual Studio, in the "Configuration Manager" under the Build tab, there is an option called the "Active Solution Platform." This causes problems with one of my commonly used libraries. Is there a way to set this to default to x64? Is there a way to have this setting set when I load a custom project template?

Extra Details

I recently installed mlpack on Windows 10 using

vcpkg install mlpack:x64-windows

I then wrote a sample mlpack project in Visual Studio and did the work to compile it. That required overcoming the error:

fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

To do that, I followed step 1 and 2 from this question.

After the project compiled, I exported it as a project template so I could build my next project faster. I started a new solution with the project template. I tried to compile the project, and I ran into error

fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

The problem was that the Build Configuration settings weren't saved with the project template. (See step 2 in the link above.) The "Active Solution Platform" in the Build Configuration menu defaulted to x86, despite that the Project's "Target Machine" (and the machine I am building on) are x64. This leads me to the question above.


Solution

  • Try to create the project in Visual Studio 2022. C++ uses x64 as Active solution platform by default in VS2022.