"class Line;"
I dont think it likes your ";" at the end of class decleration.
And i think you have forgotten the destructor for the class too.
Greetings
help with headder file containing class definition :)
That is wierd because I have a c++ book that told me I have to put ; at the end of every class declaration. I will try taking it off. the book also told me that destructors are optional. I will add one and see.
EDIT: no that didn't fix the problem
:(
EDIT: no that didn't fix the problem
:(
Quote:Original post by donjonson
That is wierd because I have a c++ book that told me I have to put ; at the end of every class declaration. I will try taking it off.
EDIT: no that didn't fix the problem
:(
well you wan't one at the end after the closing }
class A; //<--- no semicolon here please...{};//<-- but this one must be present
you have included <window.h> in the cpp file but you still use the HWND in the header file.
So one thing is to move <window.h> to the .h file.
I think its the last thing i can see.
Greetings
So one thing is to move <window.h> to the .h file.
I think its the last thing i can see.
Greetings
Thanks for all your help But I still cant get it to compile.
If I move the definition of the draw function to the top of the lines.cpp file. it flags that saying that there is no member function called Line::draw(HWND), but it wont flag on the other member function definitions in lines.cpp. so for some reason it is excluding draw in the class definition.
If I move the definition of the draw function to the top of the lines.cpp file. it flags that saying that there is no member function called Line::draw(HWND), but it wont flag on the other member function definitions in lines.cpp. so for some reason it is excluding draw in the class definition.
ok I figured out the problem.
for some reason devC++ was not saving my edits to the files. If I open up the project and make an edit and save the change will be there next time I open the project. but if i close the project and open the file individualy, the change will not have been made. hmm strange bug. In the actual file the draw declaration was commented out. I fixed it and it now compiles.
for some reason devC++ was not saving my edits to the files. If I open up the project and make an edit and save the change will be there next time I open the project. but if i close the project and open the file individualy, the change will not have been made. hmm strange bug. In the actual file the draw declaration was commented out. I fixed it and it now compiles.
You don't actually need to include windows.h in your class declaration. You just need to include the class header file AFTER windows.h. That way, the preprocessor treats it like its been declared after the stuff in windows.h.
Quote:Original post by Oberon_Command
You don't actually need to include windows.h in your class declaration. You just need to include the class header file AFTER windows.h. That way, the preprocessor treats it like its been declared after the stuff in windows.h.
And that's wrong for so many reason that I can't count them.
always, ALWAYS! make headers standalone if you can't pull in one header without also having to figure out what other arcane headers are needed you'll end up pulling your hair out later when you try to reuse stuff.
That doesn't imply including everything and it's mother forward declarations can many times suffice for headers but really that's one of the worst pieces of advice I heard on theese boards to date.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement