vs2008 连接问题集锦

来源:互联网 发布:软件实施数据库面试题 编辑:程序博客网 时间:2024/06/05 07:52

在使用vs2008总是会碰到到一些问题,为了以后不再到处找解决办法,就自己先总结下。

问题描述1:

自己这边是完全可以运行,可是一把代码发给其他同事编译运行时,就报下面错误。(属性配置是一样的,把代码发我这还是可以运行)

>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: __thiscall CWinAppEx::CWinAppEx(int)" (??0CWinAppEx@@QAE@H@Z)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CWinAppEx::~CWinAppEx(void)" (??1CWinAppEx@@UAE@XZ)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CWinAppEx::GetRuntimeClass(void)const " (?GetRuntimeClass@CWinAppEx@@UBEPAUCRuntimeClass@@XZ)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::ExitInstance(void)" (?ExitInstance@CWinAppEx@@UAEHXZ)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::LoadState(char const *,class CFrameImpl *)" (?LoadState@CWinAppEx@@UAEHPBDPAVCFrameImpl@@@Z)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::CleanState(char const *)" (?CleanState@CWinAppEx@@UAEHPBD@Z)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::SaveState(char const *,class CFrameImpl *)" (?SaveState@CWinAppEx@@UAEHPBDPAVCFrameImpl@@@Z)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::OnViewDoubleClick(class CWnd *,int)" (?OnViewDoubleClick@CWinAppEx@@UAEHPAVCWnd@@H@Z)
1>NMEALogAnalyzer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CWinAppEx::ShowPopupMenu(unsigned int,class CPoint const &,class CWnd *)" (?ShowPopupMenu@CWinAppEx@@UAEHIABVCPoint@@PAVCWnd@@@Z)

解决办法:

网上大多说的这类似问题是解决自定义类的,可是这个连接是系统CWinAppEx,网上查了很久也没找到原因,重装了vs也没解决。后面在google上无意中看到有个回复说是vs2008少装了sp1补丁,问了下同事,还真没装这个补丁,装上之后解决该问题了。


问题描述2:

将旧代码更新到新代码时,由于没使用svn只能手动修改原有的老代码,对比着修改,改完一编译,报下面两种错误:

error BK1506:cannot open file '.\Debug\XXXXX.sbr':No such file or dire.

解决办法:

右击工程->Properties->C/C++->Browse Information -----Enable Browse Information  设置为NONE

error C2872: 'string' : ambiguous symbol

 解决办法:

找工程中有多少个using namespace std;或者查找包含“string.h”头文件的地方,将不用的去掉,特别是“using namespace std”,改用头文件就行了


问题描述3:

error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject“

解决办法:

由于自己没有使用=来赋值,所以找问题原因时花费较长时间。后面发现,我定义了一个CArray<A,A&>XX,A是一个结构体,里面包含了一个CEvent成员,在XX.Add(ss)时候,系统内部会调用赋值函数,导致这个问题的出现。解决它就是自己写个赋值函数或者换种方式调用类私有成员