When I first started using this setup I downloaded the xerces-c 3.1.1
pre-compiled binaries for x86_64-windows Visual Studio 10, hoping that they
would be good enough to use with my MinGW/CodeLite setup. Obviously I was
wrong, so I downloaded the xerces-c 3.1.1 source and compiled this under
CygWin with the following as my configure command
./configure CFLAGS=-mno-cygwin
CXXFLAGS=-mno-cygwin --host=x86_64-w64-mingw32 --prefix=/home/Bidski/xerces
LDFLAGS=-no-undefined
If i link to dll file that was created with from the source that I compiled
under CygWin and include the header files from that same source, ld
complains that the dll file is of unrecognizable format. Here is the actual
output from g++.
g++ -o ./Debug/MRP ./Debug/mrp_app.o ./Debug/mrp_frame.o ./Debug/catlist.o
./Debug/inventory.o ./Debug/InventoryXML.o ./Debug/resources.rc.o
"-LC:/wxWidgets/lib/gcc_dll" "-LG:/Xerces/lib" "-L."
"-LC:/wxWidgets/lib/gcc_d"
"-LG:/Xerces/bin" -lxerces-c-3-1 -O2 -mthreads -LC:\wxWidgets\lib\gcc_dll
-lwxmsw28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32
-luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32
-lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -mwindows
G:/Xerces/bin/libxerces-c-3-1.dll: file not recognized: File format not
recognized
collect2: ld returned 1 exit status
I decided to mix things up a bit, basically because I was bored and I wanted
to see what would happen. So I used the dll from the source I compiled and
included the header files from the pre-compiled binaries I originally
downloaded, with the result that I get 4 sets of the same 2 warnings.
G:/Xerces/include/xercesc/util/KVStringPair.hpp:176: warning: 'void
xercesc_3_1::KVStringPair::setKey(const XMLCh*, XMLSize_t)' redeclared
without dllimport attribute after being referenced with dll linkage
G:/Xerces/include/xercesc/util/KVStringPair.hpp:190: warning: 'void
xercesc_3_1::KVStringPair::setValue(const XMLCh*, XMLSize_t)' redeclared
without dllimport attribute after being referenced with dll linkage
Which is basically the original problem I was having. If I link with the
library in the lib folder (.dll.a?) I get the big list of undefined
references that I mentioned in one of my earlier emails.
If I link with the .dll.a file and use the original pre-compiled binaries
header files I get the warnings and the undefined references, if I link with
the .dll.a file and use the headers from the compiled source I only get the
undefined references.
Can anyone tell me which file im supposed to be linking with? Im assuming
its supposed to be with the dll in the bin folder.
Any can anyone tell me why, when using the headers from my compiled source
ld says that the dll is of unrecognized format?
Thanks
Bidski
--------------------------------------------------
From: "Boris Kolpackov" <[email protected]>
Sent: Monday, May 24, 2010 11:50 PM
To: <[email protected]>
Subject: Re: Building under Windows with MinGW
Hi,
Bidski <[email protected]> writes:
Can anyone provide me with instructions on how to build Xerces-C++ 3.1.1
under Windows 7 Ultimate 64bit with MinGW 4.4.1. Im not using MSYS or
CygWin, just Windows and MinGW.
You will need to get one of those (CygWin is probably easier). Then
follow build instructions from the Xerces-C++ website.
Boris
--
Boris Kolpackov, Code Synthesis
http://codesynthesis.com/~boris/blog
Open-source XML data binding for C++
http://codesynthesis.com/products/xsd
XML data binding for embedded systems
http://codesynthesis.com/products/xsde
Command line interface to C++ compiler
http://codesynthesis.com/projects/cli