剥离掉所有不必要的代码之后简单的程序,这是一个拒绝编译准系统版本:不能编译使用的libxml ++,因为glibmmconfig.h没有找到
#include <iostream>
#include <libxml++/libxml++.h>
using namespace std;
int main (int argc, char *argv[]) {
cout << "Hello, World!" << endl;
return 0;
}
我使用的是先进的即Fedora的yum将这些文件放在/usr/include/libxml++-2.6/libxml++中。最初,编译器甚至找不到libml ++/libxml ++。h,因为Fedora的yum将这些文件放在/usr/include/libxml++-2.6/libxml++中。所以我通过创建符号链接/ usr/include/libxml ++到/usr/include/libxml++-2.6/libxml++来解决这个问题。已停止编译器抱怨找不到的libxml ++小时,但随后,在的libxml ++。h对行
#include <ustring.h>
再次编译找不到。所以我再次创建了一个从/ usr/include/glibmm到/usr/include/glibmm-2.4/glibmm的符号链接,这是ustring.h实际驻留的地方。现在
编译器已经停止抱怨ustring.h,但在ustring.h第一(实际)线
#include <glibmmconfig.h>
,编译器无法找到。
glibmmconfig.h的实际位置是/usr/lib64/glibmm-2.4/include。但我不想改变ustring.h。
有没有办法解决我的问题,而不必不断创建符号链接等?
在此先感谢您的帮助。
编辑
我能够避开我的问题与下列编译器选项:
`pkg-config --cflags --libs glibmm-2.4 libxml++-2.6`
感谢jpalecek为指向的方式,但我不得不寻找一些更多的,直到我能够解决我的问题。
虽然这些编译器选项编译上面的简单程序,他们编译失败的libxml++ tutorial page教程:
#include <iostream>
#include <libxml++/libxml++.h>
#include <string.h>
using namespace std;
int main (int argc, char *argv[]) {
string FilePath = "SampleXMLDocument.xml";
try {
xmlpp::DomParser Parser;
Parser.set_substitute_entities();
Parser.parse_file (FilePath);
cout << "Successfully parsed XML file" << endl;
} catch (const exception& excp) {
cout << "Exception caught: " << excp.what() << endl;
}
return 0;
} // End main()
这一次,我收到了一堆错误类似如下:
等。
我想我的搜索仍在继续。
您使用的是哪个平台/发行版? – sinelaw 2012-04-19 22:21:07
Fedora 16,正如帖子中提到的那样。 “uname -a”的输出是“Linux localhost.localdomain 3.3.2-1.fc16.x86_64#1 SMP Sat Apr 14 00:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux” – Shredderroy 2012-04-19 22:22:26
对不起,我错过了。 – sinelaw 2012-04-19 22:25:13