简体   繁体   English

列出/设置使&C ++搜索头文件的目录

[英]Listing/setting directories that make & C++ search for header files

I have a project with which I'm learning how to use make with C++ (which I'm also learning). 我有一个项目,正在学习如何在C ++中使用make(我也在学习)。 I've managed to get GCC 4.6 installed with mac ports, and have installed the Boost libraries with homebrew. 我设法通过Mac端口安装了GCC 4.6,并使用自制软件安装了Boost库。 My issue now is that my project's includes to boost aren't working with this error: 我现在的问题是我的项目中包含要提升的内容,无法解决此错误:

fatal error: boost/test/unit_test.hpp: No such file or directory 致命错误:boost / test / unit_test.hpp:没有这样的文件或目录

I guess the version of GCC I'm using (the one installed by mac ports) is not using the standard search path for include files? 我猜我正在使用的GCC版本(mac端口安装的版本)未使用包含文件的标准搜索路径? The file in question (boost/test/unit_test.hpp) is definitely on my system, at /usr/local/include. 问题文件(boost / test / unit_test.hpp)肯定在我的系统上,位于/ usr / local / include。 Is there some way that I can list the directories that are being searched in make & by GCC, so that I can verify that this is indeed the problem? 是否可以通过某种方式列出GCC在make&中搜索的目录,以便可以验证这确实是问题所在? Cheers for any & all help, Doug. 乐于助人,Doug。

gcc -v -x c -c /dev/null

will give you, among other things, the path used for searching include files. 除其他事项外,将为您提供用于搜索包含文件的路径。 You can modify this path with arguments to gcc. 您可以使用gcc的参数修改此路径。 The main one being -I/another/path/to/use but you may want to read the gcc documentation . 主要的是-I/another/path/to/use但您可能需要阅读gcc文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM