Visual Studio invokes wrong toolchain

2019-08-15 08:42发布

EDIT:

I used process Monitor to check, which executable gets invoked. it Looks like it really invokes the vs2008 executables...

https://skydrive.live.com/redir?resid=5062EFE7E0C8ECCC!2722&authkey=!AMdRW6t5aMB3u10&v=3&ithint=photo%2c.PNG

msbuild.exe executes [(12.0)tracker.exe], but gives it [(9.0)cl.exe] as command line Argument...

Any idea, how to solve this?

original

on my work computer, The VS Default templates for c++ produce build Errors. (VS2010, VS2012, VS2013)

It Kind of Looks like it invokes an old Version of the Compiler (unknown Option '/sdl', where sdl probably stands for security development LifeCycle, which has been added with vs2012, if i remember correctly)

OS: Windows 8 (x64) Installed VS Versions: 2008, 2010, 2012, 2013 (in this order)

i already tried reinstalling vs2013 and resetting the Settings.

VS2010

Visual C++ -> Win32 -> Win32 Console Application (Finish on the first page of the wizard)

1>------ Build started: Project: asd, Configuration: Debug Win32 ------
1>Build started 11.12.2013 00:22:53.
1>PrepareForBuild:
1>  Creating directory "c:\users\myusername\documents\visual studio 2010\Projects\asd\Debug\".
1>InitializeBuildStatus:
1>  Creating "Debug\asd.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  stdafx.cpp
1>  asd.cpp
1>RC : fatal error RC1106: invalid option: -ologo
1>  
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.56
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

VS2013

Visual C++ -> Win32 -> Win32 Console Application (Finish on the first page of the wizard)

1>------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>cl : Command line warning D9002: ignoring unknown option '/sdl'
1>  stdafx.cpp
1>cl : Command line warning D9002: ignoring unknown option '/sdl'
1>  ConsoleApplication1.cpp
1>LINK : fatal error LNK1117: syntax error in option 'manifest:embed'
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

If i go to Properties -> Manifest Tool -> Input and Output and Change Embed Manifest from Yes to No, it works (and the warning disappears too)

Visual C++ -> MFC -> MFC Application (Finish on the first page of the wizard)

1>------ Build started: Project: MFCApplication4, Configuration: Debug Win32 ------
1>cl : Command line warning D9002: ignoring unknown option '/sdl'
1>  stdafx.cpp
1>cl : Command line warning D9002: ignoring unknown option '/sdl'
1>  ViewTree.cpp
1>  PropertiesWnd.cpp
1>  OutputWnd.cpp
1>  MFCApplication4View.cpp
1>  MFCApplication4Doc.cpp
1>  MFCApplication4.cpp
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mfcapplication4.cpp(39): error C2065: 'm_dwRestartManagerSupportFlags' : undeclared identifier
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mfcapplication4.cpp(39): error C2065: 'AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS' : undeclared identifier
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mfcapplication4.cpp(49): error C3861: 'SetAppID': identifier not found
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mfcapplication4.cpp(86): error C3861: 'EnableTaskbarInteraction': identifier not found
1>  MainFrm.cpp
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mainfrm.cpp(351): error C2653: 'CMFCVisualManagerVS2008' : is not a class or namespace name
1>c:\users\myusername\documents\visual studio 2013\projects\mfcapplication4\mfcapplication4\mainfrm.cpp(356): error C2653: 'CMFCVisualManagerWindows7' : is not a class or namespace name
1>  FileView.cpp
1>  ClassView.cpp
1>  ChildFrm.cpp
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If i configure a MFC-Dialog based Application (which was my original goal), i get the following error:

1>------ Build started: Project: MFCApplication3, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  MFCApplication3Dlg.cpp
1>  MFCApplication3.cpp
1>  Generating Code...
1>RC : fatal error RC1106: invalid option: -ologo
1>  
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

No idea if it helps, but here is a list with all installed MS Software: https://skydrive.live.com/redir?resid=5062EFE7E0C8ECCC!2721&authkey=!APk3skYPRCffPWQ&ithint=folder%2c

2条回答
Fickle 薄情
2楼-- · 2019-08-15 09:02

Ok, i found the solution myself.

similar to this (http://social.msdn.microsoft.com/Forums/de-DE/baf613fc-3b24-4f47-9800-38499965e9dc/vs2010-is-using-a-wrong-compiler-Version) question, my "Microsoft.Cpp.Win32.user" property sheet contained references to the vs2008 directories. i have no clue how they got there, but removing them solved my problem.

open View -> Other Windows -> Property Manager

double click on Microsoft.Cpp.Win32.user

go to VC++ Directories

rows which have been changed are bold. on all bold rows, click inside the text field, then on the Dropdown menu select inherit from parent or Project Defaults

I verified that it now uses the correct Compiler by compiling the following snippet:

auto asd = std::make_unique<int>();

make_unique has been added with VS2013.

Anyone have a clue, what changed These values?

查看更多
Fickle 薄情
3楼-- · 2019-08-15 09:02

The difference between libwinutils.vcxproj and winutils.vcxproj shows the problem.

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> appears before Release|Win32 PropertyGroup.

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
  <ConfigurationType>Application</ConfigurationType>
  <UseDebugLibraries>false</UseDebugLibraries>
  <WholeProgramOptimization>true</WholeProgramOptimization>
  <CharacterSet>Unicode</CharacterSet>
  <PlatformToolset>v110</PlatformToolset>
</PropertyGroup>

Open winutils.vcxproj, and move <Import ...> after Release|Win32 PropertyGroup, like the following quote:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
  <ConfigurationType>Application</ConfigurationType>
  <UseDebugLibraries>false</UseDebugLibraries>
  <WholeProgramOptimization>true</WholeProgramOptimization>
  <CharacterSet>Unicode</CharacterSet>
  <PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

I have successfully built winutils of hadoop-2.7.0-src with VS2012 toolset.

查看更多
登录 后发表回答