Change Visual Studio 2019 Inherited Executable directories in C++ Project

mkag 21 Reputation points
2022-03-03T13:17:48.837+00:00

In one of my C++ project when I try to compile it on x64, I am getting below error:

x64\Release\command.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

There are many links, one relvent info looks to me to point Project Properties > VC++ Directories > Executable Directories to only x64 but I see in my project it is also pointing to x86 as well

The current value is "$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);"

But resolved values are as following:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\tools
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\ide
C:\Program Files (x86)\HTML Help Workshop
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin
C:\windows\Microsoft.NET\Framework\v4.0.30319\
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\windows\system32
C:\windows
and some more from PATH

I am not able to get from where it is picking first 2 entries i.e. HostX86\x64 and HostX86\x86, how can I remove "HostX86\x86"

In earlier versions, it used to be under Tools > Options

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
{count} votes

Answer accepted by question author
  1. RLWA32 51,456 Reputation points
    2022-03-04T09:38:41.273+00:00

    I suggest you create a new, Empty project. Add the source files from the problematic project to it. Do not make any changes to the Visual Studio defaults for intermediate and target directories. Does it build successfully?

    Can you successfully build the console application and the windows desktop applications created by the new project templates?

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.