我的C ++编译器在哪里解决我的#includes? [英] Where does my C++ compiler look to resolve my #includes?

查看:155
本文介绍了我的C ++编译器在哪里解决我的#includes?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个真正的基本问题。我一直在学习C ++,迄今为止我只使用标准库。我一直在包括< iostream> ,没有问题。现在我想使用Apache Xerces,所以我已经安装在我的机器(一个Debian系统),并遵循一个教程,说我需要包括:

this is a really basic question. I've been learning C++ and thus far I have only used the standard library. I have been including things like <iostream> and with no problems. Now I want to use Apache Xerces, so I've installed it on my machine (a Debian system) and am following a tutorial which says I need to include:

#include <xercesc/sax2/SAX2XMLReader.hpp>

但g ++说错误:xercesc / sax2 / SAX2XMLReader.hpp:没有这样的文件或目录。它在哪里?我需要给它更多的信息吗?

but g++ says "error: xercesc/sax2/SAX2XMLReader.hpp: No such file or directory". Where is it looking? Do I need to give it more information?

谢谢。

推荐答案

使用 - verbose 选项:

[...]
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../include/c++/4.4.2
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../include/c++/4.4.2/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/../../../../include/c++/4.4.2/backward
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.2/include-fixed
 /usr/include
End of search list.
[...]

您可以使用 -I 选项添加搜索目录,如下所述: http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Directory-Options.html#Directory-Options

You can use the -I option to add search directories, as explained here: http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Directory-Options.html#Directory-Options

您还可以使用环境变量永久更改此设置: http: //gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Environment-Variables.html#Environment-Variables

在您的情况下,您可以使用 CPLUS_INCLUDE_PATH

You can also use environment variables to change this permanently: http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Environment-Variables.html#Environment-Variables
In your case, you could use CPLUS_INCLUDE_PATH.

这篇关于我的C ++编译器在哪里解决我的#includes?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆