Advertisement

How do i organize large numbers of files?

Started by March 20, 2003 09:03 PM
1 comment, last by Guzba 21 years, 7 months ago
Im working on creating a very begginer "engine" and i am wondering how i could make it possible to have files like: camera.h (camera class) camera.cpp (camera class definer) winman.cpp (WinMain function file) opengl.h (initiation, resize, etc) etc, ima little befuddled (lol) as to how to make organize it like spread out like that instead of the 2 files i have been using hehe. I was thinking maybe i should make a prototype file containing prototypes for all the functions but when i tried that i got a lot of linker errors (maybe i did something wrong?) any tips?
"I never finish what i sta.."Computer:ATI Radeon 9700 PROP4 2.66 GHz512 RDRAM
You have your header file (.h or .hpp) that contains #includes of the other files you need, constants, function prototypes, class definitions, basically everything except the actual code that is going to do all the work. Then in the corresponding .c or .cpp file you just #include the header file and write the actual functions and/or class.

How you actually build the multiple C files into an executable is compiler specific, I can’t help you there unless you tell us what the linker errors are.

Remember when you are writing header files to do it in such a way that they will only be included once like this.


  // blag.h#ifndef BLAG_H#define BLAG_H// the contents of your header file#endif  


Good Luck.
Advertisement
thanx, i got it all worked out now!
"I never finish what i sta.."Computer:ATI Radeon 9700 PROP4 2.66 GHz512 RDRAM

This topic is closed to new replies.

Advertisement