Timotheus Pokorra, 26. January 2004.


March 2005: I recommend using the Package "Libxml 2.6.17" from DevPaks. You also need libiconv 1.9.1.

How to use libxml with Dev-C++?

Problem: using libxml-dev-2.4.22.DevPak in Dev-C++ gives the error message:
undefined reference to xmlFree

Solution: Install this package:
libxml-dev-2.4.25-special.DevPak
Thanks to Michel Weinachter for providing the DevPak Howto!


I just realise, that with this devpak still there is a crash when calling the function xmlValidateDtd. No idea at the moment how to solve that...

In Project/Project/Options, Paramaters, in C++ compiler, you have to add the define
-DLIBXML_STATIC

In Project/Project Options, Parameters, in Linker, you have to add some of the following libraries:
C:/Dev-Cpp/lib/gcc-lib/mingw32/3.2/libgcc.a
C:/Dev-Cpp/lib/libstdc++.a
C:/Dev-Cpp/lib/libiberty.a
C:/Dev-Cpp/lib/libxml2.a
C:/Dev-Cpp/lib/libwsock32.a

How to compile libxml with mingw

Download and install from mingw.org the current MinGW bin, e.g. MinGW-3.1.0-1.exe, and the current MSYS bin, e.g. MSYS-1.0.9.exe.

Download the special version of libxml libxml2-2.4.25-special.tar.gz (copied from the original location, which is now a "dirty" site....)
See the thread compiling libxml v2.4.26 with mingw under win2k on the gnome xml mailinglist archive.

Start msys.
Go into the directory where you unzipped libxml2-2.4.25-special.tar.gz, and there execute:
./configure
make

copy the resulting file from ./libs/libxml2.a to c:/mingw/lib and C:/Dev-Cpp/lib/libxml2.a
copy the libxml2-2.4.25/include/libxml folder to c:/mingw/include/libxml

When compiling directly with msys:
dont forget to include the necessary libs in your makefile:
-lxml2 -lwsock32

I also had to use -DLIBXML_STATIC for compiling the cpp files. Otherwise I got errors like
undefined reference to `_imp__xmlGenericError'
undefined reference to `_imp__xmlGenericErrorContext'
see also http://mail.gnome.org/archives/xml/2002-August/msg00084.html
see also: building libxml2 on win32

There is a mingw makefile in the zip file: download lib xml