具有相对父路径的相对包含路径的C ++ Makefile

时间:2020-01-20 12:08:39

标签: makefile g++

我有一个正在运行的项目,我需要在不更改代码的情况下参与其中,而只是为其编写新的main()。 我的目录结构:

[main_dir] / [main.cpp]

[main_dir] / [dir1] / [child1] /file1.h

[main_dir] / [dir2] / [child2] /file2.h

在main.cpp中,我有:包括“ dir1 / child1 / file1.h”

在file1.h中,我具有:包括“ dir2 / child2 / file2.h”

我正在编译: g ++ main main.cpp

我得到“ dir2 / child2 / file2.h”,没有这样的文件或目录。 我无法将file1更改为:包括“ ../../ dir2 / child2 / file2.h”

以某种方式在原始项目中使用makefile中的某些内容来搜索相对于[main_dir]的所有包含路径,以便可以找到来自file1.h的包含。

我还应该添加什么到makefile中?

0 个答案:

没有答案