C++ 本地库和相对路径
C++ local libraries and relative path
我的申请中有很多这样的包含
#include "../../libs/helper.hpp"
我很高兴从每个包含中删除 ../../libs/
。有没有办法解决这个问题,这样我就可以这样调用库了?
#include "helper.hpp"
一种可能的方法是在 make 文件中使用 -I
开关。但问题是我应该使用 angular 方括号 <
和 >
来调用库。这是不可取的,因为我更喜欢区分我的本地库和已安装的库。所以我正在寻找一种在库名称周围使用 "
来调用它的方法。
有什么办法吗?
-iquotedir
Add the directory dir to the head of the list of directories to be searched for header files only for the case of #include "file"
; they are not searched for #include <file>
, otherwise just like -I
.
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Directory-Options.html#Directory-Options
我的申请中有很多这样的包含
#include "../../libs/helper.hpp"
我很高兴从每个包含中删除 ../../libs/
。有没有办法解决这个问题,这样我就可以这样调用库了?
#include "helper.hpp"
一种可能的方法是在 make 文件中使用 -I
开关。但问题是我应该使用 angular 方括号 <
和 >
来调用库。这是不可取的,因为我更喜欢区分我的本地库和已安装的库。所以我正在寻找一种在库名称周围使用 "
来调用它的方法。
有什么办法吗?
-iquotedir
Add the directory dir to the head of the list of directories to be searched for header files only for the case of#include "file"
; they are not searched for#include <file>
, otherwise just like-I
.
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Directory-Options.html#Directory-Options