Привет всем. Я скачал и переместил источник Xerces (v3.1.1) здесь: / usr / include / xerces, и я могу видеть источник в проводнике проекта следующим образом:
MyCppProject
Двоичные файлы
Включает
[...] // некоторые другие каталоги
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? Судя по тому, что вы указали в своем вопросе, похоже, что вы используете имя папки «xercesc» вместо «xerces» в вашем пути включения.
try
#include <xerces/util/PlatformUtils.hpp>
Директива include будет искать во всех каталогах в пути include и пытаться найти указанный файл. Итак, если вы указали папку c: / something /, включите
в свой путь включения. он будет искать c: /something/include/xercesc/util/PlatformUtils.hpp
.
Если ваш файл не может быть найден, вам необходимо проверить используемые пути включения.