Eric Roy wrote:


David Bertoni wrote:
Eric Roy wrote:
I'm trying to make XOgastan\src xxx.cpp to xxx.o.
I included the XMLString.hpp in the XOgastan\src\include\utils\a2b.h.
But when i make it in BashShell(cygwin) like this:
/cygdrive/c/xogastan/src/utils
$ make

It shows:
g++ -c -DLINUX -D_REENTRANT -fpic -I/usr/include -I/src/include -I/include -o a2b.o b2b.cpp
a2b.cpp:1: warning -fpic ignored for target (all code is position
independent)
a2b.cpp: In static member function 'static std::string
a2b::XMLChar2string(const XMLCh*)':
a2b.cpp:107: error: 'XMLString' has not been declared
a2b.cpp:107: error: 'transcode' undeclared (first use this function)
a2b.cpp:107: error: (Each undeclared identifier is reported only once for
each function it appears in.)
make: *** [a2b.o] Error 1

Here is code where the error apears(a2b.cpp):
string a2b::XMLChar2string(const XMLCh* const toTranscode) {

  string target_string;
  char *char_string;

  // Call the private transcoding method
  char_string = XMLString::transcode(toTranscode);
You probably need to qualify these names with the Xerces-C namespace. There are some handy macros you can use:

char_string = XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(toTranscode);

Or, you can having using declarations:

using XERCES_CPP_NAMESPACE_QUALIFIER XMLString;
char_string = XMLString::transcode(toTranscode);

Dave



I just spend 2 hours figure it out.
It needs a namespace.
I add:

using namespace std;
XERCES_CPP_NAMESPACE_USE

in the header files
all problems solved.
but when i make the dir"xmlmanager", I also need change the include headers
like "<dom/dom.hpp>" to the right path like
"<C:/xerces-c-src_2_8_0/src/xercesc/dom/deprecated/DOM.hpp>"
You don't need to do that. You can just use a compiler or project option to add the Xerces-C include directory to the list of directories the compiler will search.

Dave

Reply via email to