带有嵌套文件夹的Eclipse C ++ Project [英] Eclipse C++ Project with nested folders
问题描述
我对C ++比较陌生;我知道语法和内容,但对编译部分知之甚少。我使用Eclipse创建了一个项目,它变得相对较大。所以在我继续之前,我想将相关文件放在一个子文件夹中。目前我的所有文件(源和标题)都在 src /
中(例如 src / Foo1.h
, src / Foo1.cpp
等),我想对它进行排序:
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
...
但是,我还希望包括相对于src文件夹(如果可能的话,也是当前文件夹)。例如,我希望 Foos / Foo1.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"
或,
#include "Foo1.h"
#include "Bars/Bar1.h"
我觉得这应该是可能的,但我恐怕不知道足够的C ++编译或Eclipse CDT来弄清楚如何做到这一点。
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.
推荐答案
添加你的路径/ src和/ src / Foos等包含路径和预处理器符号列表
Add your paths /src and /src/Foos etc to the list of Include Paths and Preprocessor Symbols
对我而言,它位于项目属性 - > C / C ++包含路径和符号
For me it is under Project Properties -> C/C++ Include Paths and Symbols
这篇关于带有嵌套文件夹的Eclipse C ++ Project的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!