c++ - g++/c++ makefile 依赖项生成忽略 boost header ?

标签 c++ makefile gnu-make

我在 g++(和 c++)中使用 makefile 依赖项生成选项,如下所示:

c++ -I/opt/local/include -MM main.cc

在文件 main.cc 上:

#include <iostream>
#include <boost/shared_ptr.hpp>

#include "projects/all_projects.h"

int main(int argc, const char * argv[])
{
  // ...
}

-MM 选项可以防止生成 iostream 的依赖关系,这很好,但对 shared_ptr.hpp 则不然。有没有一种方法可以防止 boost header (甚至尖括号中的任何 header )的依赖项生成?

我读到 gcc 的早期版本曾经将尖括号中的任何 header 视为系统 header ,但现在不再如此。

最佳答案

使用 c++ -isystem/opt/local/include -MM main.cc

(和man gcc :-))

关于c++ - g++/c++ makefile 依赖项生成忽略 boost header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20301931/

相关文章:

makefile - 为什么 "make"在 "make install"之前

c++ - 'powf' 不是 'std' 的成员

c++ - 部分模板特化触发 static_asserts

编译用 haskell 和模板 haskell 编写的共享对象并将其与 c 中的 main 链接

c++ - 找不到库,即使它在搜索路径上

bash - 无法在 makefile 中调用 bash 函数

c++ - 有没有一种方法可以创建仅使用必需的 .o 文件的 makefile?

c++ - 奇怪的错误 : EXC_BAD_ACCESS in my class

c - 如何从 Makefile.PL 中找到 C 库头文件?

makefile - GNU make : Generate rules for extracting tarballs