|
From: Scott McPhillips [MVP] on 25 Apr 2008 23:17 "Z.K." <nospam(a)nospam.net> wrote in message news:Ot8qtF0pIHA.2636(a)TK2MSFTNGP04.phx.gbl... > Seriously though, I created a SDI FormView program lets call it Test. The > main dialog type file is called TestView.cpp and its class name is > CTestView. Then I added a MFC class to the project called CMyTest (CWnd > base class). Now if I add CTestView.h to CMyTest.cpp and do nothing else I > get these errors before I even attempt to try and pass the class pointer. > > errors: > c:\Documents and Settings\#########\My Documents\Visual Studio > Projects\Test\TestView.h(19): error C2143: syntax error : missing ';' > before '*' > c:\Documents and Settings\#########\My Documents\Visual Studio > Projects\Test\TestView.h(19): error C2501: 'CTestView::CTestDoc' : missing > storage-class or type specifiers > c:\Documents and Settings\#########\My Documents\Visual Studio > Projects\Test\TestView.h(19): error C2501: 'CTestView::GetDocument' : > missing storage-class or type specifiers > c:\Documents and Settings\#########\My Documents\Visual Studio > Projects\Test\TestView.h(19): warning C4183: 'GetDocument': missing return > type; assumed to be a member function returning 'int' It's pretty clear here that line 19 refers to a document class, but you did not #include the document.h file. So the compiler does not recognize the document class name at this point. -- Scott McPhillips [VC++ MVP]
From: Igor Tandetnik on 25 Apr 2008 23:22 "Z.K." <nospam(a)nospam.net> wrote in message news:Ot8qtF0pIHA.2636(a)TK2MSFTNGP04.phx.gbl > c:\Documents and Settings\#########\My Documents\Visual Studio > Projects\Test\TestView.h(19): error C2143: syntax error : missing ';' > before '*' So, what's in file TestView.h on line 19? -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: Z.K. on 26 Apr 2008 02:25 Igor Tandetnik wrote: > "Z.K." <nospam(a)nospam.net> wrote in message > news:Ot8qtF0pIHA.2636(a)TK2MSFTNGP04.phx.gbl >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): error C2143: syntax error : missing ';' >> before '*' > > So, what's in file TestView.h on line 19? Line 19 contains: CTestDoc* GetDocument() const; which was created when the project was created.
From: Z.K. on 26 Apr 2008 04:20 Scott McPhillips [MVP] wrote: > "Z.K." <nospam(a)nospam.net> wrote in message > news:Ot8qtF0pIHA.2636(a)TK2MSFTNGP04.phx.gbl... >> Seriously though, I created a SDI FormView program lets call it Test. >> The main dialog type file is called TestView.cpp and its class name is >> CTestView. Then I added a MFC class to the project called CMyTest >> (CWnd base class). Now if I add CTestView.h to CMyTest.cpp and do >> nothing else I get these errors before I even attempt to try and pass >> the class pointer. >> >> errors: >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): error C2143: syntax error : missing ';' >> before '*' >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): error C2501: 'CTestView::CTestDoc' : >> missing storage-class or type specifiers >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): error C2501: 'CTestView::GetDocument' : >> missing storage-class or type specifiers >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): warning C4183: 'GetDocument': missing >> return type; assumed to be a member function returning 'int' > > It's pretty clear here that line 19 refers to a document class, but you > did not #include the document.h file. So the compiler does not > recognize the document class name at this point. > Ah, thanks a lot Scott; adding the TestDoc.h file fixed most of my problems. The only thing I am wondering now is when I try to declare the CMyTest class pointer in the TestView.h file, I get errors about redifinition of the CTestView which actually does make sense as I included TestView.h in MyTest.h so I had to declare the pointer in the TestView.cpp file. I would like to declare it in the header file though or I would have to declare it as global in TestView.cpp so I don't have to keep creating it every time I need to use it. Is there a way for me to declare it in the TestView.h file without getting redefinition errors? Z.K.
From: Z.K. on 26 Apr 2008 04:27 Igor Tandetnik wrote: > "Z.K." <nospam(a)nospam.net> wrote in message > news:Ot8qtF0pIHA.2636(a)TK2MSFTNGP04.phx.gbl >> c:\Documents and Settings\#########\My Documents\Visual Studio >> Projects\Test\TestView.h(19): error C2143: syntax error : missing ';' >> before '*' > > So, what's in file TestView.h on line 19? Thanks for the help Igor. My problem is mostly resolved now. If you are interested look at my response to Scott's suggestion. Z.K.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: checking whether two vector references / pointers are the same Next: $$$ on line hero $$$ |