Eclipse C ++ Project with Subfolders

I am relatively new to C ++; I know the syntax and stuff, but not much about the compilation part. I made a project using Eclipse and it became relatively large. Therefore, before continuing, I want to link related files in a subfolder. Currently, all my files (source and header) are in src/ (e.g. src/Foo1.h , src/Foo1.cpp , etc.), and I would like to sort it something like this:

 src/ -> Foos -> Foo1.h -> Foo1.cpp -> Foo2.h ... -> Bars -> Bar1.h ... -> main.cpp ... 

However, I would also like them to be included relative to the src folder (and, if possible, the current folder). For example, I would like Foos/Foo1.cpp to include things like:

 #include "Foos/Foo1.h" #include "Bars/Bar1.h" 

or,

 #include "Foo1.h" #include "Bars/Bar1.h" 

It seems to me that this should be possible, but I'm afraid that I don’t know enough about compiling C ++ or Eclipse CDT to figure out how to do this.

+4
source share
1 answer

Add your paths / src and / src / Foos etc. to the list "Include contours" and "Symbols of the preprocessor"

For me, this is in Project Properties -> C / C ++ Include Paths and Symbols

+1
source

All Articles