[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    RE: compilation errors in my application using Xerces-c
From:       "Xiaofan Zhou" <Xiaofan.Zhou () businessobjects ! com>
Date:       2005-11-22 18:51:07
Message-ID: 52DED372B580D24FA5A1C57A3140BB8FB94B92 () exch-sj04 ! usa ! businessobjects ! com
[Download RAW message or body]

 
Alberto,

Thanks much for the explanation.

But is it possible that if one uses XERCES_CPP_NAMESPACE_USE in a header
file it will result in complicting with other things? I am still seeing
some compilation errors that seem to be caused by the use of this tag.
Here are two examples:

(1) I used XERCES_CPP_NAMESPACE_USE in some of the header files in my
application where Xerces APIs are used, I then can compile most of the
files, but for one cpp file, I got the following compilation error:

x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(137) : error C2059:
syntax error : 'constant'
x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(146) : error C2143:
syntax error : missing ';' before '}'
x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(146) : error C2238:
unexpected token(s) preceding ';'
x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(164) : error C2270:
'getBooleanValue' : modifiers not allowed on nonmember functions
x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(164) : error C2072:
'xercesc_2_7::getBooleanValue' : initialization of a function
x:\xerces-c\include\xercesc\dom\DOMXPathResult.hpp(164) : fatal error
C1903: unable to recover from previous error(s); stopping compilation

However, in my application, I am not using the DOMXPathResult.hpp APIs
at all. Couldn't understand what caused this.

(2) Now if in a header file (say data.h), instead of including the
Xerces header, I used direct class referece, like this:

//#include <dom/DOM.hpp>
...other includes...

XERCES_CPP_NAMESPACE_USE
XERCES_CPP_NAMESPACE_BEGIN
class DOMNode;
XERCES_CPP_NAMESPACE_END

And then when I try to compile the data.cpp file, I got the following
error:

x:\inc\data.h(26) : error C2501: 'XERCES_CPP_NAMESPACE_USE' : missing
storage-class or type specifiers
x:\inc\data.h(26) : error C2144: syntax error : 'DOMNode' should be
preceded by ';'
x:\inc\data.h(26) : error C2501: 'XERCES_CPP_NAMESPACE_BEGIN' : missing
storage-class or type specifiers
x:\inc\data.h(31) : error C2144: syntax error : 'void' should be
preceded by ';'
x:\inc\data.h(31) : error C2501: 'XERCES_CPP_NAMESPACE_END' : missing
storage-class or type specifiers
x:\inc\options\options.h(82) : error C2872: 'DOMNode' : ambiguous symbol
        could be 'x:\inc\data.h(26) : DOMNode'
        or       'x:\xerces-c\include\xercesc\dom\DOMNode.hpp(138) :
xercesc_2_7::DOMNode'

Thanks much for any advice in advance.

Frank 

-----Original Message-----
From: Alberto Massari [mailto:amassari@datadirect.com] 
Sent: Monday, November 21, 2005 9:33 AM
To: c-dev@xerces.apache.org
Subject: RE: compilation errors in my application using Xerces-c

Hi Frank,
the conflict is probably because you use the DOMDocument class in that
file and, by using XERCES_CPP_NAMESPACE_USE, the compiler doesn't know
if "DOMDocument" should be considered as "xercesc_2_7::DOMDocument" or
as the "DOMDocument" that comes from the MSXML include files. The only
workaround is to fully qualify at least the DOMDocument reference using
the long form XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument.

Hope this helps,
Alberto

At 09.19 21/11/2005 -0800, Xiaofan Zhou wrote:
>  Alberto,
>
>Thanks for the reply. I did resolve the error  "cannot find 
>'dom/DOM.hpp' file" by adding the Xerces include path to the project 
>include directories. But for some files I still got this error:
>=========
>  c:\Program Files\Microsoft Visual Studio .NET
>2003\Vc7\PlatformSDK\Include\MsXml.h(9594): fatal error C1001: INTERNAL

>COMPILER ERROR  (compiler file 'msc1.cpp', line 2701)
>
>   Please choose the Technical Support command on the Visual C++ 
>========= And this error only occurs if I add XERCES_CPP_NAMESPACE_USE 
>to some of the header files referenced in the cpp files.
>
>In fact, the reason I got the first error "cannot find 'dom/DOM.hpp'
>file" seems to be that I changed a direct class reference (class
>DOMNode.hpp;) to instead include the header (#include 
><dom/DOMNode.hpp>) in one of the header file and use
XERCES_CPP_NAMESPACE_USE.
>
>A more general question: in a header file, if I specify 
>XERCES_CPP_NAMESPACE_USE right after the #includes, will it cause 
>conflict if I am using some other library inferfaces in the same header

>file?
>
>Thanks much in advance.
>
>Frank
>
>-----Original Message-----
>From: Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Monday, November 21, 2005 8:52 AM
>To: c-dev@xerces.apache.org
>Subject: RE: compilation errors in my application using Xerces-c
>
>Frank,
>the error "cannot find 'dom/DOM.hpp' file" means that your project does

>not specify the right directory in the 'include directories'
>property. The right one to specify would be the directory where you 
>copied the Xerces files (hopefully, you did preserve the directory 
>structure). If you still cannot find it, send an e-mail with the output

>of a dir /s command
>
>Alberto
>
>At 21.38 20/11/2005 -0800, Frank Zhou wrote:
>
> >Saurabh,
> >
> >I did copy all the include header files under my application and set 
> >the various sub project properties correct (at least I believe so), 
> >and
>
> >as I said in my previous messaage, I can actually compile most of my 
> >cpp files. Only for some of them, I got the errors. I suspect I did 
> >not
>
> >use things like 
> >XERCES_CPP_NAMESPACE_USE,XERCES_CPP_NAMESPACE_QUALIFIER
> >et cetera correctly in come cases.
> >
> >Thanks for your reply though.
> >
> >Frank
> >
> > >Hi
> > >Guess,
> > >You need to copy the "include" folder under xerces to
> >your application or >add it's \
> > >path to your project. This folder contains wuite a
> >few generated headers >(*.hpp) etc.
> >
> > >warm regards
> > >Saurabh
> > >  ----- Original Message -----
> > >  From: Xiaofan Zhou
> > >  To: c-dev@xerces.apache.org
> > >  Sent: Monday, November 21, 2005 2:16 AM
> > >  Subject: compilation errors in my application using
> >Xerces-c
> > >
> > >
> > >  Hi, All,
> > >
> > >  I am having issues compile my application in which
> >I use Xerces-c >package. Here is \
> > >what I do:
> >
> > >  First, my environment is Microsoft Visual C++
> >version 7.1.
> >
> > >  I first build the Xerces-c project (version 2.7)
> >together with ICU
> > >(version 2.8) \
> > >using the build script packageBinaries.pl in my
> >windows command line, I >used the \
> > >command:
> >
> > >  > perl packageBinaries.pl -s c:\xerces-c-src2_7_0
> >-o c:\temp\xerces->c2_7_0-win32 -t \
> > >icu -x VC7.1
> >
> > >   Everything seems fine and I got the dlls and
> >library files created.
> >
> > >  I then copied the dlls and libraries
> >(xerces-c_2_7.dll, xerces->c_2_7D.dll, \
> > >xerces-c_2.lib, xerces-c_2D.lib, icuuc.lib,
> >icuucd.lib) to my application >lib fold.
> >
> > >  Now, in my Visual C++ solution (my application), I
> >changed the >properties in the \
> > >various projects like Additional Include Directories
> >to include the path >to the \
> > >Xerces include files if the project uses the Xerces-c
> >functionalities.
> >
> > >  Now I try to compile individul source files one by
> >one. It seems that I >can compile \
> > >most of my c++ files fine, but I found that in order
> >for these files to >be compiled, \
> > >I have to put XERCES_CPP_NAMESPACE_USE in some of the
> >header files, and >sometimes I \
> > >have to use XERCES_CPP_NAMESPACE_QUALIFIER for some
> >variables.
> >
> > >  And even so, I still can not compile some of the
> >files. Here are two of >compilation \
> > >errors:
> >
> > >  (1) x:\inc\options\options.h(13): fatal error
> >C1083: Cannot open include
> > >
> > >  file: 'dom/DOM.hpp': No such file or directory
> >
> > >  (2) c:\Program Files\Microsoft Visual Studio .NET
> >
> > >  2003\Vc7\PlatformSDK\Include\MsXml.h(9594): fatal
> >error C1001: INTERNAL >COMPILER ERROR
> >
> > >  (compiler file 'msc1.cpp', line 2701)
> >
> > >  Please choose the Technical Support command on the
> >Visual C++
> >
> > >  Help menu, or open the Technical Support help file
> >for more information
> >
> > >  ==========
> > >   Can anyone gives me some advices on this?
> >
> > >   Thanks much in advance.
> >
> >
> >
> >
> >__________________________________
> >Yahoo! FareChase: Search multiple travel sites in one click.
> >http://farechase.yahoo.com
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> >For additional commands, e-mail: c-dev-help@xerces.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic