| | |
"request for member of non class type" error
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
i am trying to create a simple class to simply create an imagelist which i will later on use in a toolbar class. The problem is that the empty Add() member function has an error
i have searched around the forum and i got similar errors but i believe that their problems were different.
//this is the class declaration in file CImageList.h
//and this is the definition
//then in main.cpp I added these
Here is part of the compile log... iam using devcpp version 4.9.9.2
[ICODE]
main.cpp: In function `LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)':
main.cpp:80: error: request for member `Add' in `myImageList', which is of non-class type `CImageList ()()'
make.exe: *** [main.o] Error 1
Execution terminated
[ICODE]
ps: sorry for the long code but i have no clue what this error means.
Thanks in advance
from Dr deo
•
•
•
•
error: request for member `Add' in `myImageList', which is of non-class type `CImageList ()()'
//this is the class declaration in file CImageList.h
C++ Syntax (Toggle Plain Text)
#include<commctrl.h> class CImageList { public: CImageList(); ~CImageList(); void Add(); private: HIMAGELIST m_hImageList; };
//and this is the definition
C++ Syntax (Toggle Plain Text)
#include<windows.h> #include<commctrl.h> #include "CImageList.h" CImageList::CImageList() { m_hImageList=ImageList_Create(32, 32, ILC_COLOR32, 0, 15);//returns NULL if the fuction fails if(!m_hImageList) MessageBox(NULL,"failed to create m_hImageList","CImageList constructor error",MB_ICONERROR); else MessageBox(NULL,"m_hImageList created sucessfully :)","CImageList constructor ",MB_OK); } CImageList::~CImageList() { } void CImageList::Add() { //currently empty but for adding icons to imagelist }
//then in main.cpp I added these
C++ Syntax (Toggle Plain Text)
#include "CImageList.h" CImageList myImageList; ... ... LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_CREATE: myImageList.Add();//HERE IS THE ERROR break; .... .... } }
Here is part of the compile log... iam using devcpp version 4.9.9.2
[ICODE]
main.cpp: In function `LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)':
main.cpp:80: error: request for member `Add' in `myImageList', which is of non-class type `CImageList ()()'
make.exe: *** [main.o] Error 1
Execution terminated
[ICODE]
ps: sorry for the long code but i have no clue what this error means.
Thanks in advance
from Dr deo
![]() |
Other Threads in the C++ Forum
- Previous Thread: Calculator in a dialog box
- Next Thread: SIGSEV in array declaration inside a switch
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





