0

I have a legacy C++ Application ( Solaris Sun CC 5.6 compiled) which uses xercers XML parcer v1.6.0 from ages. All good sofar.

Recently one other third-party libraries upgrade forced us to use boost libraries along with Sun CC 5.9 compiler.

But we started seeing below issue while integrating boost libraries, operator overloading ambiguity error between boost include code and xercer librabry;

Error:

/app/home/build/thirdpaty/boost/include/boost/date_time/gregarian_calendar.ipp", line 79, Error: Overloading ambiguity between "operator+ (usigned short, const DOMString&)" and "operator+(int,int)".
"/app/home/build/thirdpaty/boost/include/boost/date_time/gregarian_calendar.ipp", line 79, Error: The operation "DOMString - unsigned short" is illegal.

Now, verified all namespaces and all ok. I didnt' include even namespace boost too; Also no code is referring operator + from code( commented all '+' code too)

Can you please suggest how to integrate both boost and xercer xml parcer libs without any ambiguity errors, any namespace hacks sothat both should work? I cannot modify xercer library headers and boost headers as well and error also showing in date_time header file. Please can you throw some light how to appraoch and what to make sure?

I am including below boost flags:

-DBOOST_TYPEOF_NATIVE -DBOOST_TYPEOF_KEYWORD=__typeof__ -DNO_INLINE_VIRTUALS -DBOOST_ALL_NO_LIB -DFAST_CONVERT -DBOOST_ENABLE_ASSERT_HANDLER

(somehow I include -DBOOST_NO_DATE_TIME_INLINE, above problem resolved but compiler has given seg fault in cg)

Yurets
  • 3,999
  • 17
  • 54
  • 74
  • You don't show the code. Why? It's not like there are zillions of people who see SunCC messages style every single day. You don't even specify the boost library version you upgraded from/to... So we can't even use the line number information shown (even thought it's insane that we should have to) – sehe May 18 '15 at 18:07

1 Answers1

0

You don't show the code.

I'm having a (very) hard time grokking the message. For one thing DOMString doesn't occur inside boost/include/boost/date_time/* (of course) and the text The operation "DOMString - unsigned short" is illegal. is not congruent with the ambiguous overload candidates shown in message directly before.

Going out on a limb I'd say that Xerces #defines an identifier to DOMString. #defines are evil for this reason.

You can verify this is what's happening by checking the preprocessed sources.

If this is the case, organize your include such that Xerces doesn't interfere anymore (isolate it and move the Xerces includes last). Perhaps it is possible to configure Xerces not to #define the macro

sehe
  • 374,641
  • 47
  • 450
  • 633