Reputation: 55
I'm relatively new to C++; I know the syntax and stuff, but not much about the compiling part. I made a project using Eclipse, and it's gotten relatively big. So before I continue on, I want to put related files together in a subfolder. Currently all my files (source and header) are in src/
(like src/Foo1.h
, src/Foo1.cpp
, etc.), and I would like to sort it something like:
src/
-> Foos
-> Foo1.h
-> Foo1.cpp
-> Foo2.h
...
-> Bars
-> Bar1.h
...
-> main.cpp
...
However, I would also like to have the includes be relative to the src folder (and the current folder too, if possible). For example, I would like Foos/Foo1.cpp
to be able to include things like:
#include "Foos/Foo1.h"
#include "Bars/Bar1.h"
or,
#include "Foo1.h"
#include "Bars/Bar1.h"
I feel like this should be possible, but I'm afraid I don't know enough about C++ compilation or Eclipse CDT to figure out how to do it.
Upvotes: 4
Views: 2071
Reputation: 1849
Add your paths /src and /src/Foos etc to the list of Include Paths and Preprocessor Symbols
For me it is under Project Properties -> C/C++ Include Paths and Symbols
Upvotes: 1