标签:
点滴记录学习VS2005过程所遇到的问题,及解决方法
1.将EVC4的工程转化成.net2005时要将工程的属性中的c/c++->代码生成->运行时库改为:多线程DLL(/MD)
2.在工程的属性中的链接器->高级->入口点改为:WinMainCRTStartup
3.WINVER not defined. Defaulting to 0x0501,问题原因:在工程的属性c/c++->预处理器->预处理器定义中加上_WIN32_WINNT=0x500试试
1.Error:uafxcwd.lib的处理
VS2005 CE6.0编程, 写一个LIB给应用调用
在应用调用LIB时产生错误, 信息详细信息:uafxcwd.lib(afxinl1.obj) : error LNK2005: "public: virtual void __cdecl CObject::Serialize(class CArchive &)" (?Serialize@CObject@@UAAXAAVCArchive@@@Z) 已经在 mfc80ud.lib(MFC80UD.DLL) 中定义
错误原因:工程和LIB的编译选项要一致。
包括字符集 Unicode, Multi-Byte... 运行库 MDD, MTD ...
产生此次错误的具体原因是:工程和LIB在设置中的“常规”/MFC的使用 项,选择不一致,导致此错误。
2.关闭 C4996 警告
例如:warning C4996: strncpy was declared deprecated
办法是在编译选项 C/C++ | Preprocessor | Preprocessor Definitions中,增加_CRT_SECURE_NO_DEPRECATE
也可以使用以下方法:
#pragma warning(disable:4996) //全部关掉 #pragma warning(once:4996) //仅显示一个
3.如果出现以下错误:
_CE_ACTIVEX was not defined because this Windows CE SDK does not have DCOM. _CE_ACTIVEX could be caused to be defined by defining _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, but it is recommended that this be done only for single-threaded apps. _ATL_NO_HOSTING was defined because _CE_ACTIVEX was not defined.
解决方法:在stdafx.h文件里加上#define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA
4.若出现以下错误:
fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds
解决方法:右击工程名,打开Project properties对话框,切换到C/C++->Code generation页,将Runtime Libarary 设置成“Multi-threaded DLL(/MD)”,即可解决此问题
5.若出现以下错误:
error C2664: ‘_wcsnicmp‘ : cannot convert parameter 2 from ‘LPWORD‘ to ‘const wchar_t *‘
解决方法:强制类型转换
6.若出现错误:
error C2065: ‘i‘ : undeclared identifier
原因分析:对于evc离开循环后,循环变量仍然有效,并且仍可以使用,但是在VS2005下是不行的,由此可见VS2005对变量的定义与审查更为严格,还有就是对数组越界问题也比EVC来的强。
解决方法:
int i = 0;
for (i = 0; i < MAX_LEN; i ++)
{
}
for (i = 0; i < MAX_NUM; i ++)
{
}
7.若出现以下错误:
error C2146: syntax error : missing ‘;‘ before identifier ‘m_wndCommandBar‘
原因分析:在Windows Mobile 5.0/6.0 下CCeCommandBar类被CCommandBar替换
解决方法:用CCommandBar m_wndCommandBar;代替CCeCommandBar m_wndCommandBar;
8.若出现以下错误:
error C2061: syntax error : identifier ‘HELPINFO‘ 或 ‘ON_WM_HELPINFO‘
解决方法:增加HELPINFO的类型,增加头文件HelpInfo.h
9.若出现以下错误:
error C2664: ‘CSize CDC::GetTextExtent(LPCTSTR,int) const‘ : cannot convert parameter 1 from ‘WORD *‘ to ‘LPCTSTR‘ Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast需要强制转换
解决方法:强制转换,例如使用pDC->GetTextExtent((LPCTSTR)&i, 1).cx;
10.如果出现以下错误:
error C2039: ‘OnHelpInfo‘ : is not a member of ‘CView‘ error C2039: ‘OnHelpInfo‘ : is not a member of ‘CFrameWnd‘ error C2039: ‘OnHelpInfo‘ : is not a member of ‘CDialog‘
解决方法:用TRUE替换相应的类成员函数OnHelpInfo,即用return TRUE;代替return CView::OnHelpInfo(pHelpInfo);
11.如果出现以下错误:
error C2039: ‘m_bShowSharedNewButton‘ : is not a member of ‘CCommandBar‘ D:Program FilesMicrosoft Visual Studio 8VCceatlmfcincludeafxext.h(557) : see declaration of ‘CCommandBar‘
解决方法:直接注释掉 m_wndCommandBar.m_bShowSharedNewButton = FALSE;
12.fatal error RC1015: cannot open include file Mobile.rc‘.
解决方法:直接注释掉:#include "wceres.rc" // WCE-specific components
或 从属性页中的“资源”/“资源文件名”从删除RC文件
13.若在Resease 模式下出现以下错误:
error LNK2019: unresolved external symbol SHInitExtraControls referenced in function "protected: __cdecl CMyAppView::CMyAppView(void)" ( 0CMyAppView@@IAA@XZ)
原因分析:程序中调用了SHInitExtraControls();
error LNK2019: unresolved external symbol SHSipPreference referenced in function "protected: void __cdecl CMyAppView::OnKillfocusWord(void)" (OnKillfocusWord@CMyAppView@@IAAXXZ)
问题:程序中调用了SHSipPreference
以上两个函数都在:Library: aygshell.lib里
解决方法:工程-->属性-->Linker -->input -- > Additional Denpendencies :aygshell.lib
14.若出现以下错误:
orelibc.lib(wwinmain.obj) : error LNK2019: unresolved external symbol wWinMain referenced in function wWinMainCRTStartup
解决方法:属性—〉Linker—〉Anvanced—〉EntryPoint 将 wWinMainCRTStartup 更改为 WinMainCRTStartup,Entry Point是WinMainCRTStartup(ANSI)或wWinMainCRTStartup(UINCODE),即: ... WinMainCRTStartup 或wWinMainCRTStartup 会调用WinMain 或wWinMain。
15.若出现以下错误:
error C3861: ‘LoadStdProfileSettings‘: identifier not found
解决方法:注释掉函数 LoadStdProfileSettings;
标签:
原文地址:http://www.cnblogs.com/91program/p/5244167.html