Cannot compile when using libxml

system picture system · Apr 4, 2011 · Viewed 12.9k times · Source

I have a source file that I can run via the terminal using

gcc source.c -I/usr/include/libxml2 -lxml2 -o output

but when I #include the source file which includes the libxml source files, the compiler complains that the libxml/xmlmemory.h: , libxml/parser.h:, libxml/xpath.h cannot be found : no such file or directory.

Answer

Benoit Thiery picture Benoit Thiery · Apr 4, 2011

You need always to keep the -I/usr/include/libxml2 in your gcc statement, so that it can find the header files.