现在的位置: 首页 > 综合 > 正文

SDI project中如何在 MainFrm.cpp中 #include “TestViw.h”

2012年07月23日 ⁄ 综合 ⁄ 共 1029字 ⁄ 字号 评论关闭

http://www.codeproject.com/Forums/1647/C-Cplusplus-MFC.aspx?fid=1647&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26#xx0xx

I create a SDI project with VC 6.0.

I have to put


#include "testView.h"

in the file MainFrm.cpp, since I need to link testView to a splitted window pane using


wndSplitter_horizontal.CreateView(0,0,RUNTIME_CLASS(CTestView),CSize(50,50),pContext);

However, the compiler complaint with the following lines.

d:\vc_project\test\testview.h(27) : error C2143: syntax error : missing ';' before '*'
d:\vc_project\test\testview.h(27) : error C2501: 'CTestDoc' : missing storage-class or type specifiers
d:\vc_project\test\testview.h(27) : error C2501: 'GetDocument' : missing storage-class or type specifiers

The error can be replayed easily by creating a SDI project and typing in the MainFrm.cpp file

#include "TestView.h"

i have had a look online, but found no solutions.

modified on Friday, January 7, 2011 9:18 AM

 

 

You should include TestDoc.h as well since CTestView depends on it. In my opinion, that should have been taken care of in the TestView.h file, to make it self supporting. But sometimes compilation speed is preferred over ease-of-use.

抱歉!评论已关闭.