eclipse cdt 相对包含路径?
嘿大家。我已将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您在问题中的陈述来看,您在包含路径中使用了文件夹名称“xercesc”而不是“xerces”。
try
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
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 forc:/something/include/xercesc/util/PlatformUtils.hpp
.If your file can't be found then you need to check the include paths being used.