[xml] libxml2: Linker problem on Cygwin

Hi List,

I am new to XML and libxml.

I tried to compile a simple XML test application provided in the libxml tutorial,. I am linking my test app with libxml2.a provided with cygwin (version - 1.3.22 (CYGWIN_NT-5.0)) running on Win2k.

My makefile is as follows:

g++ -DLIBXML_STATIC -I/usr/include/libxml2/libxml -I/usr/include/libxml2 -c test.c

g++ -DLIBXML_STATIC -L/usr/lib -lxml2 -lxml2.dll -lz -o test test.o

It gives the following errors:


test.o(.text+0x3f):test.c: undefined reference to `_xmlStrcmp'

test.o(.text+0x60):test.c: undefined reference to `_xmlNodeListGetString'

test.o(.text+0x81):test.c: undefined reference to `_xmlFree'

test.o(.text+0x127):test.c: undefined reference to `_xmlParseFile'

test.o(.text+0x158):test.c: undefined reference to `_xmlDocGetRootElement'

test.o(.text+0x184):test.c: undefined reference to `_xmlFreeDoc'

test.o(.text+0x19f):test.c: undefined reference to `_xmlStrcmp'

test.o(.text+0x1c6):test.c: undefined reference to `_xmlFreeDoc'

test.o(.text+0x1ef):test.c: undefined reference to `_xmlStrcmp'

test.o(.text+0x21b):test.c: undefined reference to `_xmlFreeDoc'

collect2: ld returned 1 exit status


It seems g++ is able to link libxml to my test application. I tried replacing g++ with gcc, but got the same result.

I tried various permutation/combination of compiler options, include, lib paths etc.,  but no effect. Please note that libxml2.a, libxml2.dll.a are available under both /lib and /usr/lib on cygwin and XML headers are available under /usr/include/libxml2/libxml.

Could you please tell me what is going wrong? How to resolve this problem?

Please help me.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]