How to organize your source code in a modular fashion
I'm currently working on a project that has the potential to get quite large, but being relatively new to C ++ and coming from a Java background, I'm not sure about the best way to proceed.
I would like to have a directory structure similar to:
+ Root
- main.cpp
+ Engine
+ Core
- foo.cpp
- foo.h
+ Utilities
- bar.cpp
- bar.h
+ Sound
+ Input
+ Collision Detection
+ Particle System
At the moment I have a download of .ccp / .h files that are in the Engine directory. When I move them to their respective folders and try to link them together, I just get pages of compilation errors related to undefined classes. Can some kind of soul help point a newbie in the right direction ?!
a source to share
You are almost certainly having trouble including included files. You need to add -I flags to the command for the directories from which you are adding the .h files.
Several of your directory names have spaces in them, so be careful to spell out directory names correctly. Or better yet, since this is often a major pain, change, for example, "Collision Detection" as "CollisionDetection" or "Collision_Detection"
a source to share