.error LNK2019: can not resolve external label "void __cdecl `eh vector destructor iterator'
4.error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA)
解决:#pragma comment(lib, "atlsd.lib")
5. error LNK2001: unresolved external symbol IID_IPOutlookApp
error LNK2001: unresolved external symbol CLSID_Application
解决方案:
加上如下定义
#define INITGUID
#include <windows.h>
#include <objbase.h>
#include <initguid.h>
#include <Pimstore.h>
6.在VS2005中添加vector容器时,包含了头文件vector和using namespace std后还是出现了以后链接错误。
error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
error LNK2001: unresolved external symbol "public: __cdecl std::exception::exception(class std::exception const &)" (??0exception@std@@QAA@ABV01@@Z)
error LNK2001: unresolved external symbol "public: __cdecl std::exception::exception
解决方案:
#pragma comment(lib, "ccrtrtti.lib")
7.fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'
解决方案:
打开Linker选项里的command line输入 /subsystem:windowsce,5.01或 //subsystem:windowsce,5.02
(分别是windows mobile 5.0和windows mobile 6.0)
编译错误
一。
1. 错误输出
./zlibrary/ui/src/win32/w32widgets/W32VBorderBox.cpp(114) : error C2589: “(”: “::”右边的非法标记
./zlibrary/ui/src/win32/w32widgets/W32VBorderBox.cpp(114) : error C2059: 语法错误 : “::”
2. 错误代码举例
view plaincopy to clipboardprint?
size.Width = std::max(size.Width, elementSize.Width);
size.Width = std::max(size.Width, elementSize.Width);
3. 函数模板max
view plaincopy to clipboardprint?
template<class _Ty> inline
const _Ty& (__CLRCALL_OR_CDECL max)(const _Ty& _Left, const _Ty& _Right)
{ // return larger of _Left and _Right
return (_DEBUG_LT(_Left, _Right) ? _Right : _Left);
}
template<class _Ty> inline
const _Ty& (__CLRCALL_OR_CDECL max)(const _Ty& _Left, const _Ty& _Right)
{ // return larger of _Left and _Right
return (_DEBUG_LT(_Left, _Right) ? _Right : _Left);
}
注:模板就是实现代码重用机制的一种工具,它可以实现类型参数化,即把类型定义为参数, 从而实现了真正的代码可重用性。模版可以分为两类,一个是函数模版,另外一个是类模版。
4. 错误原因
函数模板max与Visual C++中的全局的宏max冲突。
5. 解决办法
第一种办法:设置项目属性,在预定义处理器中添加定义NOMINMAX来禁止使用Vsual C++的min/max宏定义。
项目属性 ——> C/C++ ——> 预处理器 ——> 预处理器定义 (此处添加预定义编译开关 NOMINMAX)
第二种办法: 加上括号,与Vsual C++的min/max宏定义区分开
view plaincopy to clipboardprint?
size.Width = std::max(size.Width, elementSize.Width);
size.Width = std::max(size.Width, elementSize.Width);
修改为:
view plaincopy to clipboardprint?
size.Width = (std::max)(size.Width, elementSize.Width);
以上文章转自:http://blog.csdn.net/procedurecode/article/details/1839299