[xsd-users] Undefined reference error

David White dawhite32 at gmail.com
Wed Dec 10 15:05:07 EST 2008


Dear Boris and xsd-users,

Thanks for an excellent XML C++ binding tool.

I am stuck on a problem I cannot solve - I would appreciate your help.  In
short, I am having problems compiling the driver source (generated by XSD
cxx-parser) into a win32 exe - the problem seems to be in linking Xerces-c++
library which I built using GCC on Windows (via MinGW + MSYS).  Here is a
summary of what I have done to date:

Compile using pre-built MSVC8 library:
1. Installed xsd-3.2.msi successfully.
2. Using cxx-parser, created:
   + mymodel-pimpl.hxx/cxx
   + mymodel-pskel.hxx/cxx
   + mymodel-driver.cxx
via cmd line (see attached make_cpp_h):
xsd cxx-parser --xml-parser xerces --generate-print-impl
--generate-test-driver --root-element MMXmlFormat --output-dir
"./cxx-parser" mymodel.xsd

3. Successfully compiled and ran mymodel-driver.cxx in MSVC8.  OK.


Try to compile using gcc-built xerces library:
1. Download xerces-c-3.0.0 source.
2. Configure and make using MinGW and MSYS, via:

$ export XERCESROOT="D:\\downloads\\xerces\\xerces-c-3.0.0\\"
$ ./configure --enable-transcoder-windows --host=i686-mingw32
LDFLAGS=-no-undefined CPPFLAGS="-DXERCES_BUILDING_LIBRARY
-DXERCES_USE_TRANSCODER_WINDOWS -DXERCES_USE_WIN32_MSGLOADER
-DXERCES_USE_NETACCESSOR_WINSOCK -DXERCES_USE_FILEMGR_WINDOWS
-DXERCES_USE_MUTEXMGR_WINDOWS -DXERCES_PATH_DELIMITER_BACKSLASH
-DHAVE_STRICMP -DHAVE_STRNICMP -DHAVE_LIMITS_H -DHAVE_SYS_TIMEB_H
-DHAVE_FTIME -DHAVE_WCSUPR -DHAVE_WCSLWR -DHAVE_WCSICMP -DHAVE_WCSNICMP"
(see attached run_config)

NOTE: Followed instructions in
http://xerces.apache.org/xerces-c/build-3.html
NOTE: Preprocessor definitions obtained from MSVC8 vcproj file
NOTE: xerces-c-3.0.0 compiles with no errors.

3. Create c++ project in Eclipse (and NetBeans) and include:
   + mymodel-pimpl.hxx/cxx
   + mymodel-pskel.hxx/cxx
   + mymodel-driver.cxx
   + xercex-c library (built via gcc above)

7. On compile, the following error is produced:

undefined reference to
`_imp___ZN11xercesc_3_017SAXParseExceptionC1EPKtS2_S2_jjPNS_13MemoryManagerE'

Why?  What I don't understand is that the pre-built Windows .lib file for
MSVCx links successfully in MSVCx projects, whereas the gcc-built library I
created does not link in gcc-based projects.

I would be extremely grateful for any help you can provide.

Thanks in advance.

Kind regards, David.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run_config
Type: application/octet-stream
Size: 995 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20081211/ed35bfbe/run_config.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make_cpp_h
Type: application/octet-stream
Size: 164 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20081211/ed35bfbe/make_cpp_h.obj


More information about the xsd-users mailing list