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. Getting an error message

Getting an error message

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
8 Posts 4 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
    chaitannya_m
    wrote on last edited by
    #1

    Hi everyone, I am getting some strange error message. I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as extern CCustomUserList *p_ListUser; and CCustomUserList *p_ListUser; in MainFrm.cpp Also i have defined an attribute of class CCustomUnitList Everything works fine till here I now want to access the pointer from another class CCustomUnitList. So i declared included MainFrm.h in the CustomUnitList.h . Now i am getting an error. d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2146: syntax error : missing ';' before identifier 'm_ListUnit' d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'CCustomUnitList' : missing storage-class or type specifiers d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'm_ListUnit' : missing storage-class or type specifiers CustomUserList.cpp Strange thing is i did the same thing with another class CPackageList and things are working just as intended.

    C H S 3 Replies Last reply
    0
    • C chaitannya_m

      Hi everyone, I am getting some strange error message. I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as extern CCustomUserList *p_ListUser; and CCustomUserList *p_ListUser; in MainFrm.cpp Also i have defined an attribute of class CCustomUnitList Everything works fine till here I now want to access the pointer from another class CCustomUnitList. So i declared included MainFrm.h in the CustomUnitList.h . Now i am getting an error. d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2146: syntax error : missing ';' before identifier 'm_ListUnit' d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'CCustomUnitList' : missing storage-class or type specifiers d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'm_ListUnit' : missing storage-class or type specifiers CustomUserList.cpp Strange thing is i did the same thing with another class CPackageList and things are working just as intended.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Did you include the header file of the class ?


      Cédric Moonen Software developer
      Charting control [v1.2]

      1 Reply Last reply
      0
      • C chaitannya_m

        Hi everyone, I am getting some strange error message. I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as extern CCustomUserList *p_ListUser; and CCustomUserList *p_ListUser; in MainFrm.cpp Also i have defined an attribute of class CCustomUnitList Everything works fine till here I now want to access the pointer from another class CCustomUnitList. So i declared included MainFrm.h in the CustomUnitList.h . Now i am getting an error. d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2146: syntax error : missing ';' before identifier 'm_ListUnit' d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'CCustomUnitList' : missing storage-class or type specifiers d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'm_ListUnit' : missing storage-class or type specifiers CustomUserList.cpp Strange thing is i did the same thing with another class CPackageList and things are working just as intended.

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Did you include header file to mainfrm for CCustomUserList for example : #include "CustomUserList.h"


        WhiteSky


        C 1 Reply Last reply
        0
        • H Hamid Taebi

          Did you include header file to mainfrm for CCustomUserList for example : #include "CustomUserList.h"


          WhiteSky


          C Offline
          C Offline
          chaitannya_m
          wrote on last edited by
          #4

          yup done that... I know it's not a silly mistake.. That's why i have posted it. The header files and all are in place. I have been tracing that half the day.. only then i have posted it

          H 1 Reply Last reply
          0
          • C chaitannya_m

            yup done that... I know it's not a silly mistake.. That's why i have posted it. The header files and all are in place. I have been tracing that half the day.. only then i have posted it

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            Maybe its not your problem but I would want to ask it you said include CustomUnitList.h on the MainFrm.h I want to know did you include MainFrm.h on the CCustomUnitList.h?


            WhiteSky


            C 1 Reply Last reply
            0
            • C chaitannya_m

              Hi everyone, I am getting some strange error message. I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as extern CCustomUserList *p_ListUser; and CCustomUserList *p_ListUser; in MainFrm.cpp Also i have defined an attribute of class CCustomUnitList Everything works fine till here I now want to access the pointer from another class CCustomUnitList. So i declared included MainFrm.h in the CustomUnitList.h . Now i am getting an error. d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2146: syntax error : missing ';' before identifier 'm_ListUnit' d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'CCustomUnitList' : missing storage-class or type specifiers d:\source\baker\exp\sizecbar_src\demo2\mainfrm.h(83) : error C2501: 'm_ListUnit' : missing storage-class or type specifiers CustomUserList.cpp Strange thing is i did the same thing with another class CPackageList and things are working just as intended.

              S Offline
              S Offline
              Sam_c
              wrote on last edited by
              #6

              well it has me a bit confused

              chaitannya_m wrote:

              I have a class CCustomUnitList, which i have used in CMainFrame class. I have declare a pointer in the MainFrm.h as extern CCustomUserList *p_ListUser; and CCustomUserList *p_ListUser; in MainFrm.cpp Also i have defined an attribute of class CCustomUnitList

              you really have declared class USER not UNIT but i'll take that as a typo ensure that you really have the correct class header file included, right click and open source (to be double sure) within mainfrm.h the error is due to incorrect header file included or you spelt the class name wrong. if your 100% thats not the problem, post a snippet of the class's (just the top bit where you include the file and declare the class) and it gets more interesting :)

              1 Reply Last reply
              0
              • H Hamid Taebi

                Maybe its not your problem but I would want to ask it you said include CustomUnitList.h on the MainFrm.h I want to know did you include MainFrm.h on the CCustomUnitList.h?


                WhiteSky


                C Offline
                C Offline
                chaitannya_m
                wrote on last edited by
                #7

                yup i did that

                H 1 Reply Last reply
                0
                • C chaitannya_m

                  yup i did that

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  I think if you remove MainFrm.h of CCustomUnitList.h then you dont have these errors but if you used of some methods of MainFrm on the CCustomUnitList you will get some errors.


                  WhiteSky


                  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