I'm finally starting to make projects that aren't that small. I'm working with about 2% of the project and just testing it. It's 4 pages with incomplete functions that are just blanks as of right now(just testing a few of those functions).
Basically I'm having trouble with how header files really work. It started out with my headers just being a bunch of declarations for classes and different data structure types. These declarations looked like:
header.hpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <vector>
#include <iostream>
namespace pink {
enum blue;
enum red;
class green;
struct orange;
namespace reder {
//more of that here ...
//typedefs
} //end of reder
} //end of pink
| |
As you can see, i slowly figured out why my classes had incomplete types. I guess I needed to include the full class while defining it in the source files. For data structures, do I need to include their members inside. I'm currently defining all the data structures in source files which I think is wrong. Also when including files with the double quotes(i use linux), can I do absolute path/file names or does it only look in the current directory(like ../Blue.hpp or ~/c/d/Red.hpp?
Also, any other relevant information with large scale projects dealing with headers and what are good things to put in headers, please let me know. I'm already reading a few sources(that i'm really, ironically, enjoying reading.
Oh yeah one final problem.... I have a header file with three sources that are not getting along with each other at all.
In the header I've included all the libraries that are needed for the sources. The sources then include the header file. But for some reason, all my sources say a lot of things are undefined.
Other problems with it that may help you better understand the trouble I'm having:
yeah... nvm I just looked through the errs and all of them are "this and that isn't declared"
They are all declared in the header file. Possible not the data structures completely(enums, unions, etc).