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

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.



posted on 2011-01-09 10:13  cy163  阅读(...)  评论(...编辑  收藏

导航