Vs2010编译错误集
1、error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
在項目屬性->Configration Properties->C/C++->Command Line頁面的Additional Options中加入/wd4430
2、error MSB3073: The command regsvr32 /s /c 解決辦法??
最近將VC2002 代碼移植到VC2010,出現編譯錯誤:
1>C:\Program?Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5):?error?MSB3073:?The?command?"regsvr32?/s?/c?"D:\VC++Prj\source?code\zutai\cha06\Meter\.\Debug\Meter.dll"?
1>C:\Program?Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5):?error?MSB3073:?echo?regsvr32?exec.?time?>?".\Debug\regsvr32.trg"
1>C:\Program?Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5):?error?MSB3073:?:VCEnd"?exited?with?code?3.
英文版處理辦法:?
Project->Configuration?Properties->General->Target?Extension設置為.ocx?或者.dll
Project->Configuration?Properties->Linkerl->General?->Output?File設置為$(OutDir)$(ProjectName)$(TargetExt)
中文版處理辦法:?
在項目上點右鍵,選擇“屬性”->“配置屬性”->“常規”->“目標文件擴展名”,設置為.ocx?或者.dll
在項目上點右鍵,選擇“屬性”->“配置屬性”->“鏈接器”->“?常規?”->“輸出文件”,設置為$(OutDir)$(ProjectName)$(TargetExt)
3、altdef.h?都是這個文件里的定義
#ifndef?ATLTRY
#define?ATLTRY(x)?ATLTRYALLOC(x)
#endif //ATLTRY
出問題的都是這個宏
ATLTRY(szKey?=?new?TCHAR[cbKey]);
ATLTRY(pszW.Allocate(_convert));
??????????????????ATLTRY(szReg.Allocate(dwSize?+?1));
1>FilterImageGrabber.cpp
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(954)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(954)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(970)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(970)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(995)?:?error?C2712:?無法在要求對象展開的函數中使用?__try
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1008)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1008)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1024)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1024)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1190)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\atlcomcli.h(1190)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(107)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(107)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(113)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(113)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(423)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(423)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(587)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(587)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(901)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(901)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(971)?:?error?C2059:?語法錯誤?:?“catch”
1>C:\Program?Files\Microsoft?Visual?Studio?9.0\VC\atlmfc\include\statreg.h(971)?:?error?C2143:?語法錯誤?:?缺少“;”(在“{”的前面)
?
原來是工程屬性-〉預定義里的問題,它在里面定義了try=_try,把這個刪除就OK了
?
4、
Error MSB3073 exited with code 3
The issue that causes "Error MSB3073 exited with code 3" happens to be with the VALUE in the?Outputs?property under?Project > Properties > Configuration Properties > Custom Build Step.
When I choose Edit for Outputs, a dialog box comes up.? I enter a value of "$(OutDir)\regsvr32.trg" in the upper textbox then click OK.? Now for some reason VS 2010 changes the display text to show "$(OutDir)\regsvr32.trg;%(Outputs)".? I'm not sure why or if that is the cause of the problem.
However, I will get "Build Successful" if I change my Output value to "<inherit from parent or project defaults>" instead of choosing Edit and putting a value in.? No more Error MSB3073 exited with code 3.
I guess I can say this issue is resolved but I'd like to know why/what causes this issue to begin with.
?
5、 fatal error LNK1181: cannot open input file'largeint.lib'
在linker->Input->Additional Dependencies中去掉largeint.lib
6、error MSB3073
最近將VC2002 代碼移植到VC2010,出現編譯錯誤:
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The command "regsvr32 /s /c "D:\VC++Prj\source code\zutai\cha06\Meter\.\Debug\Meter.dll"
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: echo regsvr32 exec. time > ".\Debug\regsvr32.trg"
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: :VCEnd" exited with code 3.
英文版處理辦法:?
Project->Configuration Properties->General->Target Extension設置為.ocx 或者.dll
Project->Configuration Properties->Linkerl->General ->Output File設置為$(OutDir)$(ProjectName)$(TargetExt)
中文版處理辦法:?
在項目上點右鍵,選擇“屬性”->“配置屬性”->“常規”->“目標文件擴展名”,設置為.ocx 或者.dll
在項目上點右鍵,選擇“屬性”->“配置屬性”->“鏈接器”->“ 常規 ”->“輸出文件”,設置為$(OutDir)$(ProjectName)$(TargetExt)
?
?
7、error D8016: '/ZI' and '/GL' command-line options are incompatible
把Debug調試項改為/ZI /Od
Project Settings 項->C/C++ -> General
?
8、fatal error C1189: #error :? This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
C/C++->Preprocessor->Preprocessor Definitions中的_WIN32_WINNT=0x0501改掉就可以了
?
9、C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcomcli.h(1101): error C2059: syntax error : 'catch'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcomcli.h(1101): error C2143: syntax error : missing ';' before '{'
C/C++->Preprocessor->Preprocessor Definitions 下面的try=__try去掉。
?
10、regsvr32無法注冊控件
depends.exe打開要注冊的控件,找出這個控件所依賴的文件,缺少的文件在網上下載下來,補上就可以了。
11、Graphedt.exe打開后在任務欄里面有,但是點擊后無法顯示
打開任務管理器,在應用程序中找到Graphedt.exe,右擊選擇最大化就可以看見程序了。
12、開機自啟動的注冊表目錄:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run下面,如果要開機啟動某個程序,只要把這個程序的路徑下載這個位置就可以了。
13、彈出對話框“attempt an unsupport operation!”,是因為被關聯的控件的ID號和DoDataExchange中的控件ID不同。
14、“Encountered an improper argument”,控件被刪除了,但是還有代碼對控件進行操作而導致的
?
15、C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winioctl.h(39): error C2374: 'GUID_DEVINTERFACE_DISK' : redefinition; mult
重復包含了頭文件“winioctl.h”
16、error C2059: syntax error : 'catch'
右鍵點擊工程名,properties->Configuration Properties->C/C++->PreProcessor->Preprocessor Definitions中將try=__try去掉即可!
17、>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The command "regsvr32 /s /c D:\DirectShow及協議資料\DirectShow 實務精選+源碼\DirectShow實務精選源碼\SourceCodes\Chapter03\VODDemo\FilterNetReceiver\.\Release\FilterNetReceiver.dll
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: echo regsvr32 exec.time > D:\DirectShow及協議資料\DirectShow 實務精選+源碼\DirectShow實務精選源碼\SourceCodes\Chapter03\VODDemo\FilterNetReceiver\Release\FilterNetReceiver.trg
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: :VCEnd" exited with code 3.
18、error MSB3073
最近將VC2002 代碼移植到VC2010,出現編譯錯誤:
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: The command "regsvr32 /s /c "D:\VC++Prj\source code\zutai\cha06\Meter\.\Debug\Meter.dll"
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: echo regsvr32 exec. time > ".\Debug\regsvr32.trg"
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(183,5): error MSB3073: :VCEnd" exited with code 3.
英文版處理辦法:?
Project->Configuration Properties->General->Target Extension設置為.ocx 或者.dll
Project->Configuration Properties->Linkerl->General ->Output File設置為$(OutDir)$(ProjectName)$(TargetExt)
中文版處理辦法:?
在項目上點右鍵,選擇“屬性”->“配置屬性”->“常規”->“目標文件擴展名”,設置為.ocx 或者.dll
在項目上點右鍵,選擇“屬性”->“配置屬性”->“鏈接器”->“ 常規 ”->“輸出文件”,設置為$(OutDir)$(ProjectName)$(TargetExt)
這個仍然不能解決的話就將“屬性”->“配置屬性”->“鏈接器”->Custom Build Step中的Command line,Description,Outputs都選為默認值。即去除? 不要自注冊。
19、error C2872: “CString”: 不明確的符號?
?
DUILIB與MFC的結合
會產生Crect等沖突。
解決方法:
1:在stdafx.h中添加
#if USE(DuiLib)
#define ?CRect DuiLib::CRect
#define ?CPoint DuiLib::CPoint
#define ?CSize DuiLib::CSize
#else
#define CRect ::CRect
#define ?CPoint ::CPoint
#define ?CSize ::CSize
#endif
在用的地方定義DuiLib
2:將duilib中的crect工程中全部改名Cduirect等。全工程替換。不過一分鐘的事。
3:不在MFC中使用 using namespace Duilib 在使用duilib時都加上Duilib::Crect。
20、關于這樣的錯誤 libcpmtd.lib(string.obj) : error LNK2005: "public: void __thiscall
VC2008下 在一個動態庫工程中, 改成了編程靜態庫, 成功編譯, 但使用靜態庫的工程編譯時就出現下面一堆連接錯誤.
?
經過查找 解決方法如下:
說是因為 Project->C/C++->Code Generation->Runtime Library 這個選項,LIB和主程序(EXE)里選擇的不一致引起的。后來改成一樣就好了。
?
把exe工程 改為/MTD(因為Lib工程是選擇/MTD的) 編譯還是錯誤
于是 把EXE工程和Lib工程都選擇為/MDD 成功編譯
21、error?C2159:?more?than?one?storage?class?specified?
將vc6.0的工程轉換成vs2008居然就編譯通過了
22、error C2872: 'ostream' : ambiguous symbol
改變了#include <iostream>的位置就好了
?
總結
以上是生活随笔為你收集整理的Vs2010编译错误集的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 图像分割方法介绍
- 下一篇: LBP特征的理论介绍