Error while putting classes in separate files

+2 Bijay Das · April 14, 2015
I'm trying to put my classes in separate files but I'm getting an error. I don't know why, I've watched the 15th c++ video several times and I've done exactly same the way but I'm facing the same prob. Can anyone please help me with this?

Post a Reply

Replies

- page 3
Oldest  Newest  Rating
0 Mahmoud Abdel Mon'em · April 14, 2015
I get an error also:
"undefined references to 'WinMain@16'

Dunno what it means really, I'm still beginner at C++, learning from Bucky's videos, I've done the exact same thing he did on his video to separate classes in another file, but I'm still getting that error. If anyone can help so please say. :)
0 Dol Lod · April 14, 2015
You are putting your class and function prototypes in headers files, right? Then you include those header files  in the source files you wish to use. At least one cpp must implement all prototyped functions. You also need header guards for all header files to make sure they aren;t included more than once for each file they are loaded with. 

If you're using your own makefile, you have to list dependencies.

If you're using an IDE like Visual Studio,XCODE, simply look for warnings.

If you're using Eclipse, switch to a different IDE, ASAP. It will give you errors that are impossible to fix. 

C++

130,058 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator