You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Andreas B. Thun" <ab...@gmx.net> on 2003/03/18 11:42:32 UTC

cannot compile my simple example

Hi!

I want to parse an XML file for it's elements
and attributes (I´d like to use the DOM parser).
Unfortunately I get errors when compiling my
simple program DomParse.cpp.
The makefile seems ok to me but it is obv. not
Can anybody help?

Regards,
Andi



My program DomParse.cpp:
-----------------------------------------------
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/XMLUniDefs.hpp>

#include <string.h>
#include <stdlib.h>

int main (int argc, char* args[]) {

     try {
         XMLPlatformUtils::Initialize();
     }
     catch (const XMLException& toCatch) {
         char* message = XMLString::transcode(toCatch.getMessage());
         cout << "Error during initialization! :\n"
              << message << "\n";
         XMLString::release(&message);
         return 1;
     }
     ...
}


Compilation:
------------
g++ DomParse.cpp -I/user/abt/xerces/xerces-c-src2_2_0/include/ -L/user/abt/xerces/xerces-c-src2_2_0/lib/ -lxerces-c -o DomParse.o

DomParse.cpp: In function `int main(int, char**)':
DomParse.cpp:21: `XMLPlatformUtils' undeclared (first use this function)



Makefile:
---------
CFLAGS      = -w -O -DAPP_NO_THREADS -DXML_USE_NO_THREADS
INCLUDE_DIR = /user/abt/xerces/xerces-c-src2_2_0/include/
LIB_DIR     = /user/abt/xerces/xerces-c-src2_2_0/lib/

SRC =	DomParse.cpp

OBJ =   DomParse.o

#----------------------------------------------------------------
# use g++
#----------------------------------------------------------------
COMPILER = g++

all : $(OBJ)
	$(COMPILER) $(CFLAGS) -o DomParse $(OBJ)


#----------------------------------------------------------------
# object files
#----------------------------------------------------------------
DomParse.o : DomParse.cpp
	$(COMPILER) $(SRC) -I$(INCLUDE_DIR) -L$(LIB_DIR) -lxerces-c -o $(OBJ)


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: cannot compile my simple example

Posted by "Andreas B. Thun" <ab...@gmx.net>.
>   I *think* this is a mailing list for the Java
> implementation of Xerces. You might want to ask this
> question in the C++ Xerces list.


oops! sorry!


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: cannot compile my simple example

Posted by Panos Konstantinidis <gi...@yahoo.com>.
  I *think* this is a mailing list for the Java
implementation of Xerces. You might want to ask this
question in the C++ Xerces list.

--- "Andreas B. Thun" <ab...@gmx.net> wrote:
> Hi!
> 
> I want to parse an XML file for it's elements
> and attributes (I�d like to use the DOM parser).
> Unfortunately I get errors when compiling my
> simple program DomParse.cpp.
> The makefile seems ok to me but it is obv. not
> Can anybody help?
> 
> Regards,
> Andi
> 
> 
> 
> My program DomParse.cpp:
> -----------------------------------------------
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/dom/DOM.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/util/XMLUniDefs.hpp>
> 
> #include <string.h>
> #include <stdlib.h>
> 
> int main (int argc, char* args[]) {
> 
>      try {
>          XMLPlatformUtils::Initialize();
>      }
>      catch (const XMLException& toCatch) {
>          char* message =
> XMLString::transcode(toCatch.getMessage());
>          cout << "Error during initialization! :\n"
>               << message << "\n";
>          XMLString::release(&message);
>          return 1;
>      }
>      ...
> }
> 
> 
> Compilation:
> ------------
> g++ DomParse.cpp
> -I/user/abt/xerces/xerces-c-src2_2_0/include/
> -L/user/abt/xerces/xerces-c-src2_2_0/lib/ -lxerces-c
> -o DomParse.o
> 
> DomParse.cpp: In function `int main(int, char**)':
> DomParse.cpp:21: `XMLPlatformUtils' undeclared
> (first use this function)
> 
> 
> 
> Makefile:
> ---------
> CFLAGS      = -w -O -DAPP_NO_THREADS
> -DXML_USE_NO_THREADS
> INCLUDE_DIR =
> /user/abt/xerces/xerces-c-src2_2_0/include/
> LIB_DIR     =
> /user/abt/xerces/xerces-c-src2_2_0/lib/
> 
> SRC =	DomParse.cpp
> 
> OBJ =   DomParse.o
> 
>
#----------------------------------------------------------------
> # use g++
>
#----------------------------------------------------------------
> COMPILER = g++
> 
> all : $(OBJ)
> 	$(COMPILER) $(CFLAGS) -o DomParse $(OBJ)
> 
> 
>
#----------------------------------------------------------------
> # object files
>
#----------------------------------------------------------------
> DomParse.o : DomParse.cpp
> 	$(COMPILER) $(SRC) -I$(INCLUDE_DIR) -L$(LIB_DIR)
> -lxerces-c -o $(OBJ)
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-j-user-help@xml.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org