2014-01-09 79 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升級過程中移動)

這只是一個警告,所以不應該。

相關問題