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
处理方法:
#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
处理方法
#ifndef WINVER 0x0500
#define _WIN32_WINNT 0x0500
#endif
实际异常十一:
afximpl.h中MENUGETOBJECTINFO、HRAWINPUT找不到而出错。
处理方法:
typedef struct tagMENUGETOBJECTINFO {
} MENUGETOBJECTINFO, *PMENUGETOBJECTINFO;
typedef struct HRAWINPUT__ * HRAWINPUT;
实际异常十二:
Error
处理方法:
Configuration Properties->Linker->Input->Ignore Specific Default Libraries=libc.lib
实际异常十三:x264
Error
Error
处理方法:
将\x264\common\osdep.h中#ifdef __WIN32__改为#ifdef WIN32
实际异常十四:
Error
Error
处理方法:
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
实际异常十六:
处理方法:
函数体内,变量声明必须在开始处,不得在语句中或之后。
实际异常十七:
Error
处理方法:
AtlLoadSystemLibraryUsin
实际异常十八:
....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
处理方法:
安装相应的汇编编译器并复制其主程序到vc\bin文件夹下即可。
实际异常二十三:
Error
处理方法:
安装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