vc 编译连接错误汇总:

来源:互联网 发布:sql的update语句 编辑:程序博客网 时间:2024/06/04 17:59
编译连接错误汇总:
--------------------------------------------------------------------------------
症状:
d:\work\feature.h : warning C4819: The file contains a character
that cannot be represented in the current code page (936).
Save the file in Unicode format to prevent data loss
--------------------------------------------------------------------------------

错误原因:字符编码与你的code page 不符,但并不像它所提示的改为unicode 编码。
解决办法:如果你使用的是multibyte 字符集,将文件编码改为cp936 解决


--------------------------------------------------------------------------------
症状:
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:\work\myvoice\client\client\wavefile.cpp(123) : error C2664: 'mmioOpenW' : cannot convert parameter 1 from 'char *' to 'LPWSTR'
--------------------------------------------------------------------------------
错误原因: VS2005默认的设置是采用UNICODE字符集,其函数调用都是W()型调用。
解决办法:改为函数调用采用ansi型,即工程属性->配置属性->常规->字符集 项 选择“使用多字节字符集”


--------------------------------------------------------------------------------
症状:
 "public: __thiscall CCommonBuffer::~CCommonBuffer(void)" (??1CCommonBuffer@@QAE@XZ)
referenced in function "public: static bool __cdecl CWaveFile::LoadWaveFile(char const *,class CCommonBuffer *,struct WF_INFO *,int)"
(?LoadWaveFile@CWaveFile@@SA_NPBDPAVCCommonBuffer@@PAUWF_INFO@@H@Z)
 "public: bool __thiscall CCommonBuffer::DupBuffer(class CCommonBuffer *)" (?DupBuffer@CCommonBuffer@@QAE_NPAV1@@Z)
referenced in function "public: static bool __cdecl CWaveFile::LoadWaveFile(char const *,class CCommonBuffer *,struct WF_INFO *,int)"
(?LoadWaveFile@CWaveFile@@SA_NPBDPAVCCommonBuffer@@PAUWF_INFO@@H@Z)
 "public: void __thiscall CCommonBuffer::ResetBuffer(int)" (?ResetBuffer@CCommonBuffer@@QAEXH@Z)
referenced in function "public: static bool __cdecl CWaveFile::LoadWaveFile(char const *,class CCommonBuffer *,struct WF_INFO *,int)"
(?LoadWaveFile@CWaveFile@@SA_NPBDPAVCCommonBuffer@@PAUWF_INFO@@H@Z)
....
1>D:\work\myvoice\client\Debug\client.exe : fatal error LNK1120: 7 unresolved externals
--------------------------------------------------------------------------------
错误原因:缺少dll 文件
解决办法:
project property->linker->general->additional library directory: 填库路径
project property->linker->input->additional dependencies: 填库名称

--------------------------------------------------------------------------------
症状:
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR80D.dll)
....
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>D:\work\myvoice\vpr\Debug\vpr.exe : fatal error LNK1120: 1 unresolved externals
--------------------------------------------------------------------------------
错误原因: 连接了一个外部调试版dll, 结果出现 libcmtd 与MSVCRTD 冲突,
这说明dll 中已经有一套了,系统默认连接库与之重复包含,重复定义了。

解决办法: 只要忽略 MSVCRTD 或者 LIBCMTD 即可。
project property->link->input->ignore specific library,
添加MSVCRTD来忽略它. 重新编译。通过。
或者添加LIBCMTD来忽略它 ,重新编译.通过
单步跟踪,还可以单步跟踪到dll 中去(需要指定源代码位置)。
只不过这种方式虽可调试dll 代码, 但在vc环境中浏览阅读dll 代码不太方便,
正确的做法还是在dll 工程中调试dll,有浏览信息。


0 0
原创粉丝点击