MFC创建程序的问题

[复制链接]
查看11 | 回复1 | 2010-10-17 12:01:39 | 显示全部楼层 |阅读模式
俺就是在用MFC创建命为CEditApp后,在CEditAppDoc.cpp中直接加了以下代码
void CEditAppDoc::SetModifiedFlag(BOOL bModified /* = TRUE */)
{
CString strTitle = GetTitle();
CString strDirtyFlag = " *"; // note space before the ’*’
// so we don’t break Save As dialog
if (!IsModified() && bModified)
{
SetTitle(strTitle + strDirtyFlag);
}
else if ( IsModified() && !bModified )
{
int nTitleLength = strTitle.GetLength();
int nDirtyLength = strDirtyFlag.GetLength();
SetTitle( strTitle.Left(nTitleLength - nDirtyLength) );
}
UpdateFrameCounts();
CDocument::SetModifiedFlag(bModified);
}
然后在CEditView中直接加了以下代码:
void CEditAppView::OnChange()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CEditView::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
GetDocument()->SetModifiedFlag(TRUE);
// TODO: Add your control notification handler code here
}
编译出现如下提示:
linking...
EditApp.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CEditAppDoc::classCEditAppDoc" (?classCEditAppDoc@CEditAppDoc@@2UCRuntimeClass@@B)
EditApp.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CMainFrame::classCMainFrame" (?classCMainFrame@CMainFrame@@2UCRuntimeClass@@B)
EditApp.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CEditAppView::classCEditAppView" (?classCEditAppView@CEditAppView@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/EditApp.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
EditApp.exe - 5 error(s), 0 warning(s)
提问者: 逍遥王子0524 - 二级处理提问

回复

使用道具 举报

千问 | 2010-10-17 12:01:39 | 显示全部楼层
把你遇到的问题说清楚些! 我创建了和你一样的工程,加入你写的代码,没有任何编译链接问题。所以,你先用MFC创建一个原始的单文档工程,名字为EditApp,先不要修改任何代码,编译试试有没有问题。如果没有,再加入你的代码看看结果。 这样可以确定问题出在哪,有可能是你VC环境的问题。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行