win32/mfc/qt 異常處理與總結

win32/mfc/qt 異常處理與總結

實際異常一:
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReport
Debug/B機.exe : fatal error LNK1120: 1 unresolved externals
處理辦法:
property pages->Configuration Propertyies->C/C++->Code Generation->Runtime Library->Multi-threaded Debug(/MTd)


實際異常二:
Error 30 error C3861: 'CryptReleaseContext': identifier not found c:\users\administrator\desktop\mywin32http-dll\common\include\stringprocess.h 472 1 MyWin32Http-dll
處理方法:
#define _WIN32_WINNT 0x0502


實際異常三:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
處理方法:
project->BaseClasses properties->configuration->C/C++ ->Command Line,增加/wd4430選項。

實際異常四:

中文亂碼,單字節字符(vc6)、Unicode(vc8 vc9 vc10)

處理方法:

property pages->Configuration Propertyies->General->Character Set->Use Multi-Byte Character Set

 實際異常五:

VC++ 2008編譯錯誤fatal error C1902問題的解決

處理方法:

將C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mspdbsrv.exe複製到C:\Program Files\Microsoft Visual Studio 9.0\VC\bin下即可。

實際異常六 :

error LNK2019: unresolved external symbol wWinMain referenced in function wWinMainCRTStartup

處理方法:

1.Linker->Advanced頁,將Entry Point由wWinMainCRTStartup改成WinMainCRTStartup

2.Configuration Properties->C/C++->Preprocessor,然後在右邊欄的Preprocessor Definitions對應的項中刪除_CONSOLE, 添加_WINDOWS.
3.Configuration Properties->Linker->System,然後在右邊欄的SubSystem對應的項改爲Windows(/SUBSYSTEM:WINDOWS)

4.檢查是否存在C的引用,如有則加上extern "C"{ }

  

 實際異常七:

處理方法:

在stdafx.h文件最上面加入#define _USE_32BIT_TIME_T

實際異常八:

Run-Time Check Failure #2 - Stack around the variable 'dect' was corrupted.

處理方法:

C/C++->Code Generation->Basic Runtime Checks=Default

實際異常九:

vc2005及以上和6.0的DLL導出函數中有wchar_t, 都無法被對方使用, 必須在vc2005及以上版本中做如下設置

處理方法:

C/C++-->Language->Treat wchar_t as Built-in Type --> No (/Zc:wchar_t-)

實際異常十:

Error 2 error C1189: #error :  This file requires _WIN32_WINNT to be #defined at least to 0x0500. Value 0x0501 or higher is recommended. c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxcomctl32.h 23 1 XPFace
處理方法

#ifndef WINVER 0x0500 
#define _WIN32_WINNT 0x0500 
#endif

實際異常十一:

afximpl.h中MENUGETOBJECTINFO、HRAWINPUT找不到而出錯。

處理方法:

typedef struct tagMENUGETOBJECTINFO {
 DWORD dwFlags;
 UINT  uPos;
 HMENU hmenu;
 PVOID riid;
 PVOID pvObj;
} MENUGETOBJECTINFO, *PMENUGETOBJECTINFO;

typedef struct HRAWINPUT__ * HRAWINPUT;

實際異常十二:

Error 125 error LNK1104: cannot open file 'LIBC.lib' C:\test\LINK test

處理方法:

Configuration Properties->Linker->Input->Ignore Specific Default Libraries=libc.lib

實際異常十三:x264

Error 220 error LNK2019: unresolved external symbol _strtok_r referenced in function _parse_zones D:\x264\build\win32\libx264.lib(ratecontrol.obj) x264
Error 221 error LNK1120: 1 unresolved externals D:\x264\build\win32\bin\x264.exe 1 1 x264

處理方法:

將\x264\common\osdep.h中#ifdef __WIN32__改爲#ifdef WIN32

實際異常十四:

Error 150 error LNK1123: failure during conversion to COFF: file invalid or corrupt C:\video\LINK creenVideo
Error 149 error CVT1100: duplicate resource.  type:MANIFEST, name:1, language:0x0413 C:\video\CVTRES creenVideo

處理方法:

1. Project propert\ linker\ 啓用增量鏈接:否;(關閉增量鏈接)
2. 設置工程屬性->配置屬性-> 清單工具->輸入和輸出->嵌入清單,選擇[否]
3. 在工程的.rc文件裏面刪除了manifest塊. 刪除VC6.0外部Manifest文件。設置生成嵌入式清單,並在附加清單依賴項: Microsoft.Windows.Common-Controls。

實際異常十五:

C++調用C函數找不到。

處理方法:

#ifdef __cplusplus

extern "C" {

#endif

int ConvertScreen(int width, int height, const char * src, char * dest);

#ifdef __cplusplus

}

#endif

實際異常十六:

 13 IntelliSense: a value of type "void *" cannot be assigned to an entity of type "uint8_t  *" s:\test\main.c 749 24 Test

處理方法:

函數體內,變量聲明必須在開始處,不得在語句中或之後。

實際異常十七:
Error 1 error C3861: 'AtlLoadSystemLibraryUsingFullPath': identifier not found c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltransactionmanager.h 312 1 TestMfc

處理方法:

AtlLoadSystemLibraryUsingFullPath改爲LoadLibraryW

實際異常十八:

....could not be opened because the microsoft visual C# 2010 compiler could not be created

處理方法:

打開註冊表直接刪除HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0即可

實際異常十九:

error C2668: 'pow' : ambiguous call to overloaded function

處理方法:

在vs03或者vc6.0裏,可以直接寫成:pow(i, 2)

在vs05和vs2008中需要改成:pow((double)i, 2),需要給i一個確定的類型。

實際異常二十: 

error C1083: Cannot open include file Permission denied

處理方法:

修改引用中路徑爲正確即可

 實際異常二十一:

Compiler Error C2146 syntax error : missing 'token' before identifier 'identifier'
處理方法:
檢查是否沒有給類型添加相應的引用

 實際異常二十二:

Error 89 error MSB6006: "cmd.exe" exited with code 9009. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 151 6 libx264

處理方法:

安裝相應的彙編編譯器並複製其主程序到vc\bin文件夾下即可。

實際異常二十三:

Error 1 error C1083: Cannot open include file: 'streams.h': No such file or directory d:\users\administrator\desktop\amcap\stdafx.h 23 1 AmCap
處理方法:

安裝DirectX 9.0B SDK,裏面有directshow相應的資源,之後版本的sdk,directshow被併到windows platform sdk裏去了。

實際異常二十四:

/lib/ld-linux.so.2:bad ELF interpreter:No such file or directory

處理方法:

yum install glibc.i686

實際異常二十五:

Qwt is configured without SVG support

處理方法:

打開qtconfig.pri,把QWT_CONFIG     += QwtSvg 屏蔽掉

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章