eclipse cdt 相对包含路径?

发布于 2024-09-15 16:59:14 字数 1033 浏览 8 评论 0原文

嘿大家。我已将 Xerces (v3.1.1) 源代码下载并移至此处:/usr/include/xerces,我可以在项目资源管理器中看到源代码,如下所示:

MyCppProject

  • Binaries

  • Includes< /p>

    • [...] // 一些其他目录

    • 练习

      • dom

      • [...] // 一些其他目录

而且,这是我的简单 C++ 代码:


#include <xercesc/util/PlatformUtils.hpp>
using namespace xercesc; #include <iostream> using namespace std; int main(int argc, char* argv[]) { try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { return 1; } XMLPlatformUtils::Terminate(); return 0; }

并且,这是我收到的错误(以及因未包含此文件而导致的其他错误):

../main.cpp:1:42: error: xercesc/util/PlatformUtils.hpp: No such file or directory

什么我不明白相对路径在源文件中是如何工作的。当我说输入时

#include <xercesc/util/PlatformUtils.hpp>
where is it looking, if not on the include paths already listed in the project explorer?

Hey all. I've downloaded and moved the Xerces (v3.1.1) source here: /usr/include/xerces and I can see the source in the project explorer like this:

MyCppProject

  • Binaries

  • Includes

    • [...] // some other directories

    • xerces

      • dom

      • [...] // some other directories

And, here's my simple C++ code:


#include <xercesc/util/PlatformUtils.hpp>
using namespace xercesc; #include <iostream> using namespace std; int main(int argc, char* argv[]) { try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { return 1; } XMLPlatformUtils::Terminate(); return 0; }

And, here's the error that I get (along with others that are caused by this file not being included):

../main.cpp:1:42: error: xercesc/util/PlatformUtils.hpp: No such file or directory

What I don't understand is how the relative paths work in the source file. When I say type

#include <xercesc/util/PlatformUtils.hpp>

where is it looking, if not on the include paths already listed in the project explorer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-09-22 16:59:14

从您在问题中的陈述来看,您在包含路径中使用了文件夹名称“xercesc”而不是“xerces”。

try

#include <xerces/util/PlatformUtils.hpp>

include 指令将查找包含路径中的所有目录并尝试查找指定的文件。因此,如果您在包含路径中指定了文件夹 c:/something/include 。它将搜索c:/something/include/xercesc/util/PlatformUtils.hpp

如果找不到您的文件,那么您需要检查正在使用的包含路径。

From what you state in your question it looks like your using the folder name 'xercesc' instead of 'xerces' in your include path.

try

#include <xerces/util/PlatformUtils.hpp>

The include directive will look in all of the directories in the include path and try to find the file specified. So if you specified a folder c:/something/include in your include path. it would search for c:/something/include/xercesc/util/PlatformUtils.hpp.

If your file can't be found then you need to check the include paths being used.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文