VS2010编译工具出错的解决办法

简介:
一、问题现象
VC2010编译任何工程都出错。
错误信息:
1>------ Build started: Project: UserModule, Configuration: Debug Win32 ------
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(147,5): error MSB6006: "CL.exe" exited with code -1073741515.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
二、解决办法1、原因
通过观察,发现工程属性中的可执行文件路径指向VC2008的路径。
2、一种临时解决办法
设置工程属性中的可执行文件路径。
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
 
设置之后,编译果然成功了。
但是,不可能每个工程都去修改一次工程属性吧?
3、最终解决办法
在Property Manager中修改VC++目录(注:这里的修改是全局生效的。与项目、属性中的设置不同。)
 
打开Property Manager的方法:
View->Property Manager (it is near the bottom) or View->Other Windows->Property Manager
修改为:(ExcludePath暂时未做修改)
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include;$(ExecutablePath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\include;$(IncludePath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib;$(ReferencePath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib;$(LibraryPath)
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl;C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm;C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src;$(SourcePath)
 
 
注:
网上也有资料介绍下面这种清除用户数据的方法,但我的环境上这种操作不能解决问题。
 
打开VS2010命令行,执行 devenv /ResetUserData, 稍等一会,完成。
然后再启动VS2010,会提示第一次启动时的环境设置对话框,去掉“Migrate 老的设置”前面的对勾,然后启动VS2010。
 
三、参考资料
感谢这个帖子中提供解决方案的crescens2k。

http://social.msdn.microsoft.com/Forums/en-CA/vcgeneral/thread/ca399aec-1b5e-41a3-9cd5-76a74420f940

Right, if you notice the path to your compiler it is actually picking up the VC9 compiler on your system. This is why you are getting this problem. This is a known bug in the environment.

What you can try is

1) Open your Visual Studio Command Prompt (Can get to it through Start->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt)

2) Run DevEnv /ResetUserData wait for it to finish (it may take a while)

3) Open Visual Studio itself and it will give you the same window as when you first run Visual Studio. Make sure you deselect Migrate my eligable settings checkbox before you select your configuration and then select Start Visual Studio.

4) Open your project and try again.

If it still fails then it is likely that something was saved into the project itself. In this case go to Project Properties->Configuration Properties->VC++ Directories and replace set each of the Paths to the Following

Executable Directories to $(ExectablePath)

Include Directories to $(IncludePath)

Reference Directories to $(ReferencePath)

Library Directories to $(LibraryPath)

Source Directories to $(SourcePath)

Exclude Directories to $(ExcludePath)

Please note you need to keep the exact formatting, so when you locate Executable Directories, in the box on the right replace the entire contents with $(ExecutablePath) for example. If you do that you will put the project specific settings to the default too and (hopefully) will fix everything.

----------------------------------------

It was still inherited even after you reset your environment?

Hmm, ok.

Open up Property Manager, if you selected the VC configuration then it should be on the left automatically. If not, you can find it either under View-&gt;Property Manager (it is near the bottom) or View-&gt;Other Windows-&gt;Property Manager. You will need a VC project loaded. In Property Manager, under <Project Name>-&gt;Debug | Win32 look for Microsoft.Cpp.Win32.User.

Right click on this and select properties. Go to Common Properties-&gt;VC++ Directories and check these out. But since these should inherit from the others directly then the best you can do is override the paths yourself here. The only thing that I could think of to override these is if you have VSINSTALLDIR and VCINSTALLDIR set on a global scale.

Could you look at one final thing, if you go to Control Panel-&gt;System-&gt;Advanced system settings and click on the Environment Variables button. Under either of these can you find VCINSTALLDIR and VSINSTALLDIR set to anything?

 











本文转sinojelly51CTO博客,原文链接:http://blog.51cto.com/sinojelly/400502,如需转载请自行联系原作者

相关文章
|
机器学习/深度学习 自然语言处理 Python
传统的序列模型CRF实现和优劣势
传统的序列模型CRF实现和优劣势
|
C语言
C语言栈的括号匹配的检验讲解及相关代码
C语言栈的括号匹配的检验讲解及相关代码
432 0
|
数据采集 机器学习/深度学习 Python
在Python中进行数据清洗和预处理缺失值处理缺失值补全
在Python中进行数据清洗和预处理缺失值处理缺失值补全
677 3
|
5月前
|
存储 机器学习/深度学习 缓存
阿里云服务器4核8G配置租用价格:不同实例收费标准、活动价格对比与选购参考
4核8G配置是深受初创企业用户喜欢的云服务器配置,2025年截止目前,按量收费标准最低降至0.45元/小时,包年包月租用平均优惠月价最低仅需159.84元/月,按年购买还可享受u1实例4核8G活动价955.58元/年起的价格。云服务器实例规格和配置不同,收费标准与活动价格也不同,下面是小编为大家整理汇总的阿里云服务器4核8G配置2025年最新收费标准与活动价格。
663 5
阿里云服务器4核8G配置租用价格:不同实例收费标准、活动价格对比与选购参考
|
存储 算法 大数据
ZooKeeper的架构
【6月更文挑战第21天】ZooKeeper的架构
479 38
|
消息中间件 负载均衡 Kafka
Kafka分区分配策略大揭秘:RoundRobin、Range、Sticky,你真的了解它们吗?
【8月更文挑战第24天】Kafka是一款突出高吞吐量、可扩展性和数据持久性的分布式流处理平台。其核心特性之一是分区分配策略,对于实现系统的负载均衡和高可用性至关重要。Kafka支持三种主要的分区分配策略:RoundRobin(轮询)、Range(范围)和Sticky(粘性)。RoundRobin策略通过轮询方式均衡分配分区;Range策略根据主题分区数和消费者数量分配;而Sticky策略则在保持原有分配的基础上动态调整,以确保各消费者负载均衡。理解这些策略有助于优化Kafka性能并满足不同业务场景需求。
1246 59
|
SQL Java 数据库连接
MyBatis-Plus高级用法:最优化持久层开发
MyBatis-Plus 通过简化常见的持久层开发任务,提高了开发效率和代码的可维护性。通过合理使用条件构造器、分页插件、逻辑删除和代码生成器等高级功能,可以进一步优化持久层开发,提升系统性能和稳定性。掌握这些高级用法和最佳实践,有助于开发者构建高效、稳定和可扩展的企业级应用。
771 13
|
存储 NoSQL 关系型数据库
【赵渝强老师】MongoDB的存储结构
MongoDB 是一个可移植的 NoSQL 数据库,支持跨平台运行。其逻辑存储结构包括数据库、集合和文档,而物理存储结构则由命名空间文件、数据文件和日志文件组成。视频讲解和示意图进一步解释了这些概念。
437 5
|
Web App开发 JavaScript 中间件
构建高效后端服务:Node.js与Express框架的完美结合
【10月更文挑战第21天】本文将引导你走进Node.js和Express框架的世界,探索它们如何共同打造一个高效、可扩展的后端服务。通过深入浅出的解释和实际代码示例,我们将一起理解这一组合的魅力所在,并学习如何利用它们来构建现代Web应用。
451 1
|
机器学习/深度学习 算法 搜索推荐
深度学习之差分隐私
基于深度学习的差分隐私是一种在保护用户隐私的同时使用数据进行模型训练的技术。它的核心理念是通过加入随机噪声来隐藏个体数据的影响,防止在分析或模型训练过程中泄露个人信息。
1426 1