-
syntax error
Code:
public:
void ShowWindow(bool show);
HWND Createwindow(CodeClass *cclass, HWND Parent, int X, int Y, int Width, int Height);
CWindow();
virtual ~CWindow();
HWND hWnd;
};
There is a problem for Createwindow. I get an error complaining about CodeClass *cclass. I pushed F1 and it said that the error is caused because the compiler found an identifier that is not expected.
How can I fix this?
Thanx in advance!
-
Did you
#include "codeclass.h"
Or declare
class CodeClass;
so it knows what you're talking about
-
CodeClass is a structer. I tryed to just declare it once where the DLLMain function is but then I get too many errors. Thus I declared a few of them where I need it. Now I get 1 error. And that is this. I declared CodeClass before I declared this header.
Edit:
I accidently deleted my post before the post below. I didn't expect any one to answer that post that fast.
>Where is a good place to declare my structure? for me to be able to use it in any class.
Thanx Salem.
-
In a header file
Which you then #include in all the places which need to know about that structure
Don't forget the multiple inclusion guards
Code:
#ifndef FILE_INCLUDED
#define FILE_INCLUDED
// body of header file
#endif
Just see pretty much any header file which comes with your compiler.
-
I tryed that and it solved all my problems. As I continued I needed a variable to be accessed by multiple Classes. This variable is the hInstance of my project. I created another variable called Hinstance. Where I placed my class structer for other classes to use it I placed the declaration of the Hinstance varaible. But I get errors saying that the variable is defined more than once. In the file I did something like this;
#ifndef SHARED_
HINSTANCE Hinstance
define SHARED_
#endif
How can I make a variable for it to be accessed by other classes in my program?
Thanx in advance!