Getting an error message
-
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.
-
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.
Did you include the header file of the class ?
Cédric Moonen Software developer
Charting control [v1.2] -
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.
Did you include header file to mainfrm for
CCustomUserList
for example : #include "CustomUserList.h"
WhiteSky
-
Did you include header file to mainfrm for
CCustomUserList
for example : #include "CustomUserList.h"
WhiteSky
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
-
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
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
-
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.
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 :)
-
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
yup i did that
-
yup i did that
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