[xsd-users] Visual Studio Express 2008 integration and makefile
project
Russ Loucks
rjl at third-monday.com
Wed Jan 5 16:52:36 EST 2011
On 01/05/2011 12:04 PM, Russ Loucks wrote:
> Well, unfortunately, I had to abandon my Cygwin-based project on
> Windows and was kindly told to use Visual Studio for a development
> platform. Managers.....
>
> Granted, I'm more of a *nix n Java developer so I'm not so up-to-speed
> on Visual Studio C++-based projects...
>
> Anyway, I have a simple VSE 2008 makefile-based project which uses the
> Qt development toolkit. I started with the basic Address Book example
> in the Qt tutorials and just added a single XSD file and tried to link
> it in.
>
> Specifically:
>
> 1) took hello.xsd from the examples/tree directory and ran 'xsd' on it:
> $ c:/Programs/xsd-3.3.0/bin/xsd.exe cxx-tree --hxx-suffix .h
> --cxx-suffix .cpp hello.xsd
>
> 2) In VS ran my build on the project. The build output follows:
>
> cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100
> -w34189 -DUNICODE \
> -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB
> -DQT_CORE_LIB \
> -DQT_THREAD_SUPPORT -I"c:\Programs\Qt\4.7.0\include\QtCore" \
> -I"c:\Programs\Qt\4.7.0\include\QtGui"
> -I"c:\Programs\Qt\4.7.0\include" -I"." \
> -I"c:\programs\xsd-3.3.0\libxsd"
> -I"c:\Programs\xerces-c-3.1.1\include" \
> -I"c:\Programs\Qt\4.7.0\include\ActiveQt" -I"debug" \
> -I"c:\Programs\Qt\4.7.0\mkspecs\default" -Fodebug\ \
> @C:\Users\RUSSLO~1\AppData\Local\Temp\nm4694.tmp
>
> hello.cpp
> addressbook.cpp
> main.cpp
>
> link /LIBPATH:"c:\Programs\Qt\4.7.0\lib" /NOLOGO /DEBUG /MANIFEST \
> /MANIFESTFILE:"debug\addressBook.intermediate. manifest"
> /SUBSYSTEM:WINDOWS \
> "/MANIFESTDEPENDENCY:type='win32'
> name='Microsoft.Windows.Common-Controls' \
> version='6.0.0.0 ' publicKeyToken='6595b64144ccf1df' language='*'\
> processorArchitecture='*'" /OUT:debug\addressBook.exe \
> debug\hello.obj debug\addressbook.obj debug\main.obj
> debug\moc_addressbook.obj \
> c:\Programs\Qt\4.7.0\lib\qtmaind.lib \
> /LIBPATH:C:\Progra ms\xerces-c-3.1.1\lib
> C:\Programs\xerces-c-3.1.1\lib\xerces-c_3.lib \
> c:\Programs\Qt\4.7.0\lib\QtGuid4.lib c:\Programs\Qt\
> 4.7.0\lib\QtCored4.lib \
>
> hello.obj : error LNK2001: unresolved external symbol "public:
> virtual unsigned short const * __thiscall xercesc_3_1::In
> putSource::getEncoding(void)const "
> (?getEncoding at InputSource@xercesc_3_1@@UBEPBGXZ)
>
> hello.obj : error LNK2001: unresolved external symbol "public:
> virtual unsigned short const * __thiscall xercesc_3_1::In
> putSource::getPublicId(void)const "
> (?getPublicId at InputSource@xercesc_3_1@@UBEPBGXZ)
>
> . . . . .
>
> hello.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: static unsigned short const * const
> xercesc_3_1::XMLUni::fgDOMErrorHandler"
> (__imp_?fgDOMErrorHandler at XMLUni@xercesc_3_1@@2QBGB)
>
> hello.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: static unsigned short const * const
> xercesc_3_1::XMLUni::fgXercesLoadSchema"
> (__imp_?fgXercesLoadSchema at XMLUni@xercesc_3_1@@2QBGB)
>
> . . . . .
>
> Hmmm. The xerces-c_3.lib file is on the link path. In total I get 23
> undefined symbols. If I comment out the use of the xerces-c_3.lib
> file, I get 39 undefined symbols....
>
> I also tried adding the xerces-c_3_1_1.dll file found in the
> xerces-3.1.1\bin directory, but that didn't change anything.
>
> Stumped again......
>
> Ideas?
>
I think I figured this one out, as well (at least using the hello.xsd
from the sample directory).....
The Qt 'qmake' system, when it 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 pava
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....
More information about the xsd-users
mailing list