我在 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/