After stripping away all of the unnecessary code, this is the barebones version that refuses to compile:
#include <iostream>
#include <libxml++/libxml++.h>
using namespace std;
int main (int argc, char *argv[]) {
cout << "Hello, World!" << endl;
return 0;
}
I'm using an up-to-the-minute version of Fedora 16. Initially, the compiler could not find even libml++/libxml++.h, because Fedora's yum puts these files in /usr/include/libxml++-2.6/libxml++. So I got around that by creating the symlink /usr/include/libxml++ to /usr/include/libxml++-2.6/libxml++. That stopped the compiler from complaining about not finding libxml++.h, but then, in libxml++.h there is the line
#include <ustring.h>
which again the compiler could not find. So once again I created a symlink from /usr/include/glibmm to /usr/include/glibmm-2.4/glibmm, which is where ustring.h actually resides.
Now the compiler has stopped complaining about ustring.h, but the first (actual) line in ustring.h is
#include <glibmmconfig.h>
which the compiler cannot find.
The actual location of glibmmconfig.h is /usr/lib64/glibmm-2.4/include. But I would prefer not to alter ustring.h.
Is there a way out of my problems without constantly having to create symlinks, etc.?
Thanks in advance for your help.
EDIT
I was able to get around my problems with the following compiler options:
`pkg-config --cflags --libs glibmm-2.4 libxml++-2.6`
Thanks to jpalecek for pointing the way, but I had to hunt some more until I was able to get around my problem.
But while these compiler options compile the simple programme above, they fail to compile the tutorial on the 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 ()
I guess my search continues.
No comments:
Post a Comment