visual-c++detours

Unable to compile Microsoft Detours


I cloned the lates Microsoft Detours and try to compile in Visual Studio:

1>LINK : warning LNK4281: undesirable base address 0x7100000 for x64 image; set base address above 4GB for best ASLR optimization
1>LINK : warning LNK4281: undesirable base address 0x7200000 for x64 image; set base address above 4GB for best ASLR optimization
1>LINK : warning LNK4281: undesirable base address 0x7300000 for x64 image; set base address above 4GB for best ASLR optimization
1>LINK : warning LNK4281: undesirable base address 0x1900000 for x64 image; set base address above 4GB for best ASLR optimization
1>LINK : warning LNK4281: undesirable base address 0x1A00000 for x64 image; set base address above 4GB for best ASLR optimization
1>error CS1668 : Warning as error : Invalid search path 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\atlmfc\lib\x64' specified in 'LIB environment variable' -- 'The system cannot find the path specified. '
1>NMAKE : fatal error U1077: 'C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\csc.EXE' : return code '0x1'
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(54,5): error MSB3073: The command "SET DETOURS_TARGET_PROCESSOR=x64
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(54,5): error MSB3073: cd ..
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(54,5): error MSB3073: nmake clean
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(54,5): error MSB3073: nmake" exited with code 2.
1>    5 Warning(s)
1>    5 Error(s)

The folder referred to 14.29.30133 does not have a atlmfc sub folder on my PC. But these two folders do:

I can't workout where to change this in the IDE.


Solution

  • I edited the vcxproj file and replaced:

    <PlatformToolset>v142</PlatformToolset>
    

    with

    <PlatformToolset>v143</PlatformToolset>
    

    Now it compiles with no errors.