简体   繁体   中英

build xerces c++ version 3 with icu

I want to build Xerces 3.1.1 with ICU using Visual c++ express 2010.

I've downloaded ICU source and built it like it says in the readme.

Now i need to build Xerces with the ICU binaries i just built.

The build instructions for version 3.1.1 in Xerces's site state that "You can also select whether the Xerces-C++ library should use ICU for transcoding" but they don't say exactly how. I looked at all the build options and the only thing i found (maybe i missed something?) that may be related is the pre processor macro list, i saw the following definition - XERCES_USE_TRANSCODER_WINDOWS.

I thought that maybe i need to change it to XERCES_USE_TRANSCODER_ICU. It's just a guess, so first i looked in the Xerces code and i saw XERCES_USE_TRANSCODER_ICU does appear (for example, they check if it's defined before including ICU headers).

So I've changed XERCES_USE_TRANSCODER_WINDOWS to XERCES_USE_TRANSCODER_ICU, added ICU include directory to the include directory path and all ICU .lib files to the linker dependencies and tried to build it like that. I get unresolved external errors:

PlatformUtils.obj : error LNK2019: unresolved external symbol "public: __thiscall xercesc_3_1::ICUTransService::ICUTransService(class xercesc_3_1::MemoryManager *)" (??0ICUTransService@xercesc_3_1@@QAE@PAVMemoryManager@1@@Z) referenced in function "private: static class xercesc_3_1::XMLTransService * __cdecl xercesc_3_1::XMLPlatformUtils::makeTransService(void)" (?makeTransService@XMLPlatformUtils@xercesc_3_1@@CAPAVXMLTransService@2@XZ) 1>C:\\cpp_lib\\xerces-c-3.1.1\\projects\\Win32\\VC10\\xerces-all\\XercesLib...........\\Build\\Win32\\VC10\\Debug\\xerces-c_3_1D.dll : fatal error LNK1120: 1 unresolved externals

The Xerces site provide more specific instructions for building Xerces 2.8 with ICU (it won't work on version 3 because it's done through a script that isn't provided with version 3). I tried that also (although i need to use the latest version) and it also didn't work well. No .dll or .lib files were created.

Thanks.

Because I had the same problem and this is one of the first Google hits looking for it, I will give an answer although it's been some time now since you asked the question. These are the steps to build Xerces-c in Visual Studio (worked in VS10 for me) with ICU:

  1. Download and build ICU as described.
  2. Open the xerces-all.sln solution file with VS.
  3. Select the ICU Debug/Release build configuration - it sets XERCES_USE_TRANSCODER_ICU for you.
  4. Add the include and library paths for ICU to the porperties of the XercesLib project, add the icu libs in the additional linker dependencies of that project.
  5. Build and be happy - no need to exclude WIN32TransService.cpp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM