Visual Studio调用错误的工具链

时间:2013-12-10 23:28:37

标签: visual-studio-2010 visual-studio visual-studio-2012 visual-studio-2013

修改

我使用进程Monitor来检查,调用哪个可执行文件。看起来它确实调用了vs2008可执行文件......

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

msbuild.exe执行[(12.0)tracker.exe],但是将[(9.0)cl.exe]作为命令行参数...

任何想法,如何解决这个问题?

原始

在我的工作计算机上,c ++的VS Default模板会产生构建错误。 (VS2010,VS2012,VS2013)

看起来它有点像调用旧版本的编译器( unknown Option'/ sdl',其中sdl可能代表安全开发LifeCycle,已添加vs2012,如果我记得的话正确地)

操作系统:Windows 8(x64) 已安装的VS版本:2008,2010,2012,2013(按此顺序)

我已经尝试重新安装vs2013并重置设置。

VS2010

Visual C ++ - > Win32 - > Win32控制台应用程序(在向导的第一页上完成)

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控制台应用程序(在向导的第一页上完成)

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 ==========

如果我去属性 - >清单工具 - >输入和输出并将嵌入清单更改为,它可以工作(并且警告也会消失)

Visual C ++ - > MFC - > MFC应用程序(在向导的第一页上完成)

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 ==========

如果我配置基于MFC对话框的应用程序(这是我的原始目标),我会收到以下错误:

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 ==========

不知道它是否有帮助,但这是一个包含所有已安装的MS软件的列表: https://skydrive.live.com/redir?resid=5062EFE7E0C8ECCC!2721&authkey=!APk3skYPRCffPWQ&ithint=folder%2c

2 个答案:

答案 0 :(得分:1)

好的,我自己找到了解决方案。

类似于这个(http://social.msdn.microsoft.com/Forums/de-DE/baf613fc-3b24-4f47-9800-38499965e9dc/vs2010-is-using-a-wrong-compiler-Version)问题,我的“Microsoft.Cpp.Win32.user”属性表包含对vs2008目录的引用。我不知道他们是如何到达那里的,但删除它们解决了我的问题。

打开查看 - >其他Windows - >物业经理

双击 Microsoft.Cpp.Win32.user

转到 VC ++目录

已更改的行为粗体。在所有粗体行上,在文本字段内单击,然后在下拉菜单中选择从父项继承或项目默认值

我通过编译以下代码段验证它现在使用了正确的编译器:

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

make_unique已添加VS2013。

任何人都有线索,这些值有什么变化?

答案 1 :(得分:1)

libwinutils.vcxprojwinutils.vcxproj之间的差异显示了问题。

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />出现在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>

打开winutils.vcxproj,然后在<Import ...> PropertyGroup之后移动Release|Win32,如下所示:

<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" />

我已经使用VS2012工具集成功构建了hadoop-2.7.0-src的winutils。