Libxml2: undefined reference to xmlTextReaderConstName

I installed the latest libxml2-2.8.0 , as usual: $ ./configure , $ make , $ make install .

$ xml2-config --cflags --libs gives this output:

 -I/usr/local/include/libxml2 -L/usr/local/lib -lxml2 -lm 

But trying to compile any example ...

 $ gcc `xml2-config --cflags --libs` xmltest.c 

The component says:

 /tmp/cc8ezrPl.o: In function `processNode': xmltest.c:(.text+0x19): undefined reference to `xmlTextReaderConstName' xmltest.c:(.text+0x38): undefined reference to `xmlTextReaderConstValue' ...etc. 

Everything I was looking for could be enabled with the xml2-config --cflags --libs or upgrading to the latest libxml2 version or something like that. Unfortunately, it does not work for me.

What could be the steps to identify a problem?

Using Ubuntu 12.04 64-bit.

+4
source share
1 answer

Libraries should only be specified after the source file so that the linker can resolve undefined references in the source file. Try making an example using this

 gcc -I/usr/local/include/libxml2 -L/usr/local/lib xmltest.c -lxml2 -lm 
+9
source

All Articles