我的应用程序中有很多这样的包含
#include "../../libs/helper.hpp"
我很高兴在那里删除 ../../libs/
从每一个包括。有什么办法可以解决这个问题,这样我就可以这样调用库了吗?
#include "helper.hpp"
一种可能的方法是使用 -I
在 make 文件中切换。但问题是我应该使用尖括号 <
和 >
用于调用库。这是不可取的,因为我更喜欢区分我的本地库和已安装的库。所以我正在寻找一种方法来调用它 "
围绕库的名称。
有什么办法吗?
最佳答案
-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
关于C++ 本地库和相对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35010222/