C++ 本地库和相对路径

标签 c++ c gcc c-preprocessor

我的应用程序中有很多这样的包含

#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/

相关文章:

c++ - Windows 下的 igzip 编译

c - "invalid use of void expression"

c++ - 如何解释 g++ 生成的 .i 文件

c++ - 两个封装组件之间的通信

c++ - 二维 vector 未正确保存和加载 boost::serialize 库

c++值和变量之间的不同打印行为

c++ - 如何添加颜色图,OpenCV?

c++ - 在 C 或 C++ 中用 1 到 10^10 的随机数填充数组

c++ - GCC 4.6.2 内联行为

android - arm-gcc编译器编译的c代码的头文件