Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. #include "testView.h" in MainFrm.cpp [modified]

#include "testView.h" in MainFrm.cpp [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cy163 hotmail com
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • C cy163 hotmail com

      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

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      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.

      home

      C 1 Reply Last reply
      0
      • N Niklas L

        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.

        home

        C Offline
        C Offline
        cy163 hotmail com
        wrote on last edited by
        #3

        Thank you for your reply. when I create a SDI project with AppWizard, I notice there are lines in the testView.h file

        public:
        CTestDoc* GetDocument();

        but there is no #include "testDoc.h". The program works fine though. However,when I simply put the line

        #include "testView.h"

        into the MainFrm.cpp file the error message pops up. I think the error message is suppose to occur in the former case.

        L 1 Reply Last reply
        0
        • C cy163 hotmail com

          Thank you for your reply. when I create a SDI project with AppWizard, I notice there are lines in the testView.h file

          public:
          CTestDoc* GetDocument();

          but there is no #include "testDoc.h". The program works fine though. However,when I simply put the line

          #include "testView.h"

          into the MainFrm.cpp file the error message pops up. I think the error message is suppose to occur in the former case.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The reason it works fine in the first case is because in all files where testView.h is included (test.cpp and testView.cpp in a standard project), testDoc.h is included before testView.h.

          #include "testDoc.h"
          #include "testView.h"

          So the advice to include testDoc.h first, is correct.

          C 1 Reply Last reply
          0
          • L Lost User

            The reason it works fine in the first case is because in all files where testView.h is included (test.cpp and testView.cpp in a standard project), testDoc.h is included before testView.h.

            #include "testDoc.h"
            #include "testView.h"

            So the advice to include testDoc.h first, is correct.

            C Offline
            C Offline
            cy163 hotmail com
            wrote on last edited by
            #5

            I see now. Thanks

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups