PDA

View Full Version : Using Code Synthesis XSD in Visual Studio in Qt projects



redBeard
5th January 2011, 22:59
I'm starting the 'address book' in the Qt tutorial section on Windows using Visual Studio Express 2008. Nice tutorial, BTW.

My real goal is to incorporate a number of 3rd party toolkits - I use that address book demo as my test bed.

The first one is XSD data binding from Code Synthesis.

That toolkit is an XML data binding package that seems to work pretty well for what I need. It works well on Linux n Mac but I'm having problems getting it to link into my Qt project. It requires use of the Xerces-C++ package from Apache. I downloaded the pre-build VC9.0 binaries/libraries for that.

I'm using VSE 2008 (makefile-based project) and I'm getting lots of undefined symbols. For the Xerces-C++ library I'm using the lib\xerces-c_3.lib library found in that distribution. I know that library file exists because if I mistype that library name the link fails quickly with 'unable to find library file' (or something like that):


hello.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_1::InputSource::getEncoding(void)const " (?getEncoding@InputSource@xercesc_3_1@@UBEPBGXZ)
hello.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_1::InputSource::getPublicId(void)const " (?getPublicId@InputSource@xercesc_3_1@@UBEPBGXZ)
hello.obj : error LNK2001: unresolved external symbol "public: virtual unsigned short const * __thiscall xercesc_3_1::InputSource::getSystemId(void)const " (?getSystemId@InputSource@xercesc_3_1@@UBEPBGXZ)

Has anyone else successfully incorporated the Code Synthesis/Xerces-C++ packages into a Qt project using MS VS?

Thanks.

Added after 1 58 minutes:


I'm using VSE 2008 (makefile-based project) and I'm getting lots of undefined symbols. For the Xerces-C++ library I'm using the lib\xerces-c_3.lib library found in that distribution. I know that library file exists because if I mistype that library name the link fails quickly with 'unable to find library file' (or something like that):

Has anyone else successfully incorporated the Code Synthesis/Xerces-C++ packages into a Qt project using MS VS?

I think I figured this one out, as well (at least using the hello.xsd from the Code Synthesis XSD sample directory).....

When 'qmake' generates the makefiles for Visual Studio builds, specifies a compiler option, '/Zc:wchar_t-', which means the system requires you (the developer) to define the 'wchar_t' type. All files of the project are compiled with this option.

The Xerces-C++ compiled binaries for VS 2008 (9.0) specify this option as '/Zc:wchar_t' (no trailing dash), which means treat the 'wchar_t' type as native. Also, the VC9.0 project files in the source distribution have this set, as well. I downloaded the source source distribution and compiled this package and experienced the same errors.

Apparently mixing modes in an application is no-no......

I just set the '/Zc:wchar_t' option in my project makefile, did a build all and it compiled and worked!

Wow. Not to comment on the news, but HOCO - Holy Obscure Compiler Options, Batman....

On to the next problems....