Search code examples
visual-studiovisual-c++visual-studio-2017

Can you set Visual Studio 2017 CPU target for old CPU?


Is there a way to setup Visual Studio 2017 to support older CPU? Say one that doesn't have SSE2?

Thanks.


Solution

  • You can select what CPU extensions to use (or not to use any) in the project's settings. The following works in VS2019 but, IIRC, it's very similar for VS2017.

    In the solution explorer, right-click on the project and select "Properties" from the pop-up menu. Open the C/C++ tree list and select the Code Generation page. Then, in the "Enable Enhanced Instruction Set" select the "No Enhanced Instructions" option (or "Not Set," if that isn't available), as below:

    enter image description here

    The "No Enhanced Instructions" option will instruct the compiler to use only the 'basic' Intel-x86 instruction set (which should work for a Pentium CPU).

    The equivalent command-line option is /arch:IA32, which, as per M/S Documentation:

    Specifies no enhanced instructions and also specifies x87 for floating-point calculations.

    In older versions of MSVC, there was an option to include code guards against the "Pentium FDIV Bug," (/QIfdiv) but it appears that has now been removed.