2014-01-09 81 views
0

Visual Studio Express 2010中,我通常只能建立一个程序,然后进行任何更改,我必须将我的代码粘贴到一个新项目中。它会说构建是成功的,但后来我试着运行它,并得到一个错误消息说,是什么导致MS Visual Studio无法识别构建错误?

“这个项目已过时 - 你想建立它吗?

我点击是,然后我收到另一个错误消息,说有构建错误,我必须从上一次成功构建继续。 有时而不是运行一次成功构建,我得到一个错误信息说,

“无法打开[目录下的程序。系统找不到指定的文件 。”

因为这个原因,我通常使用Visual Express 2012,但即使这样,它偶尔会发生,看似随意。一旦问题开始,没有明显的方法来解决它(重建和重新启动Visual Studio都有相同的结果)。在Visual Studio Pro 2012这似乎也发生。

编辑:这是一个在我(2010年版)

1>------ Build started: Project: Lab01, Configuration: Debug Win32 ------ 
1> Lab01.cpp 
1>c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll : warning C4945: 'ExtensionAttribute' : cannot import symbol from 'c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll': as 'System::Runtime::CompilerServices::ExtensionAttribute' has already been imported from another assembly 'mscorlib' 
1>   c:\windows\microsoft.net\framework\v4.0.30319\mscorlib.dll : see declaration of 'System::Runtime::CompilerServices::ExtensionAttribute' 
1>   first seen type is used; re-order imported assemblies to use the current type 
1>   This diagnostic occurred while importing type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
1>Lab01.cpp(28): error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem &)' : cannot convert parameter 1 from 'char [101]' to 'char &' 
1>   with 
1>   [ 
1>    _Elem=char, 
1>    _Traits=std::char_traits<char> 
1>   ] 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

前面的输出框我猜它说的错误在那里,但它告诉我“构建成功”出于某种原因。 ..

+0

我想到的两件事:1 - 你有写作权限的项目和目录你试图使用? 2 - 您是否在使用CMake在VS中构建项目? –

+0

问题是什么? – egur

+1

'从最后一次成功构建'继续 - 错误出现在“视图 - >错误列表”中? (或者他们不?)另外,我假设你在运行之前打“build”并在运行之前检查错误列表?“重建”必须提供比“项目已过期”更多的其他错误。在构建它更详细的内容后,还要检查'Output'窗口。 – 2014-01-09 14:39:01

回答

2

下面是如何发现和分析由Visual Studio报告的错误:

continue from the last successful build - 点击NO(几乎总是)。错误应显示在View->Error List中。当感到困惑时,在构建之后总是检查View->Output窗口,这是很多相同的信息,但更详细。

rebuilding ... same result - 完全重建应该给project is out of date以外的其他错误。

Lab01.cpp(28): error C2664: - 第28行和第3行上下Lab01.cpp会有所帮助。

看起来你正在做的事情与std :: streams是不正确的,但我不知道什么没有看到代码。 这应该是在错误列表

warning C4945: - 这是因为你使用的.NET 4.0和4.5,(可能)在单个项目中的一个CLR和非CLR代码拌一拌。从已选择正确.Net库版本的新CLR项目重新创建,可能会删除此警告。 (ExtensionAttribute在4.0到4.5升级过程中移动)

这只是一个警告,所以不应该。

相关问题