> ----- Original Message -----
> From: "David Bertoni" <[EMAIL PROTECTED]>
> To: [email protected]
> Subject: Re: Compiling simple Xalan example
> Date: Fri, 17 Feb 2006 11:30:55 -0800
>
>
> kuba m wrote:
> > hello, I am using Linux - Ubuntu, I downloaded Xerces-C++ 2.7.0
> > and Xalan-C++ 1.10.0 binaries, followed the instructions on the
> > website and managed to build both, I can run Xalan from the
> > command line - so this means that it built fine, doesn't it ?
>
> If you downloaded the binaries, you don't need to build anything.
> You only need to build if you download the source distributions.
>
> > However there is a problem if I want to compile some sample c++
> > code that uses Xalan. I followed the instructions on this website
> > : http://rudeserver.com/xalan/
> > I try to compile the test.cpp file from that site,this way :
> > g++ -o test -I /home/halski/parsery/xml-xalan/c/src/xalanc/ -I
> > /home/halski/parsery/xerces-c-src_2_7_0/include/
> > /home/halski/parsery/xerces-c-src_2_7_0/ test.cpp
> > /usr/lib/libxalan-c.so /usr/lib/libxerces-c.so
> >
> > and I am getting this :
> > test.cpp: In function ‘int main()’:
> > test.cpp:20: error: ‘XMLPlatformUtils’ has not been declared
> > test.cpp:20: error: ‘Initialize’ was not declared in this scope
> > test.cpp:21: error: ‘XalanTransformer’ has not been declared
> > test.cpp:21: error: ‘initialize’ was not declared in this scope
> > test.cpp:24: error: ‘XalanTransformer’ was not
> > declared in this scope
> > test.cpp:24: error: expected `;' before ‘theXalanTransformer’
> > test.cpp:27: error: ‘XSLTInputSource’ was not
> > declared in this scope
> > test.cpp:27: error: expected `;' before ‘xmlIn’
> > test.cpp:28: error: expected `;' before ‘xslIn’
> > test.cpp:29: error: ‘XSLTResultTarget’ was not
> > declared in this scope
> > test.cpp:29: error: expected `;' before ‘xmlOut’
> > test.cpp:33: error: ‘theXalanTransformer’ was not
> > declared in this scope
> > test.cpp:33: error: ‘xmlIn’ was not declared in this scope
> > test.cpp:33: error: ‘xslIn’ was not declared in this scope
> > test.cpp:33: error: ‘xmlOut’ was not declared in this scope
> > test.cpp:39: error: ‘XalanTransformer’ is not a class
> > or namespace
> > test.cpp:40: error: ‘XMLPlatformUtils’ has not been declared
> > test.cpp:40: error: ‘Terminate’ was not declared in this scope
> > test.cpp:41: error: ‘XalanTransformer’ is not a class
> > or namespace
> > test.cpp:41: error: ‘ICUCleanUp’ was not declared in this scope
> >
>
> Did you take a look at the sample programs? It's hard to say what
> might be wrong since you didn't post any source code, but it's
> probably an issue with C++ namespaces. If you look at one of the
> sample programs, you will see lines of code like this:
>
> XALAN_USING_XERCES(XMLPlatformUtils)
> XALAN_USING_XALAN(XalanTransformer)
>
> These are macros that wrap the C++ using directive, which brings a
> name into the current scope. Alternately, you can do the following:
>
> xercesc::XMLPlatformUtils::Initialize();
>
> and:
>
> xalanc::XalanTransformer::initialize();
>
> Dave
Yep, sorry - of course I downloaded sources and built it - not binaries. The
file that gives me the above compilation errors is this :
#include <Include/PlatformDefinitions.hpp>
#include <util/PlatformUtils.hpp>
#include <XalanTransformer/XalanTransformer.hpp>
#include <iostream>
using namespace std;
int main(void)
{
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanTransformer theXalanTransformer;
XSLTInputSource xmlIn("foo.xml");
XSLTInputSource xslIn("foo.xsl");
XSLTResultTarget xmlOut("foo-out.xml");
int theResult = theXalanTransformer.transform(xmlIn, xslIn, xmlOut);
cout << "Result of Transformation is " << theResult << "\n";
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();
return 0;
}
After trying to compile some samples it seems to me that there is something
wrong with the directory structure or include statements, eg. for xerces I have
this option : -I /home/halski/parsery/xerces-c-src_2_7_0/include/
and I get an error :
XalanTransform.cpp:29:42: error: xercesc/util/PlatformUtils.hpp: No such file
or directory
obvious - as there is no xercesc directory in /xerces-c-src_2_7_0/include/
HAve you got any ideas ? What am I doing wrong ?
I am not a fluent linux user so please be patient...
Maybe I should build Xerces and Xalan once again ?
thanks,
jakub
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com
Powered by Outblaze