Compiler can't find libxml/parser.h
Try to compile with explicite inclusion where the parser.h
file is, i.e. smth like this
g++ -I/usr/include/libxml2/
Following environment variables can also be used for lookup of header files
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH
Find more information here
libxml/parser.h: in c++ ubuntu
Before Posting the answer THANKS to the people who have answered, but those answers were not worked for me
I have just copied libxml folder from the directory usr/lib/libxml2 and pasted in usr/lib directory and compiled my code it is not giving any error. It is working fine now.
code::blocks, libxml2 / libxml/parser.h: No such file or directory
In general, it's better to not move things into the mingw directories, but to leave them in their own directories, and add search paths to the project properties so it knows where to look for them.
If you go into your project properties in Code::Blocks, hit the Project build options button, then inside the Linker Settings tab, add the two libraries you're linking against. Then In the Search directories tab, add the /include
to compiler search locations, and optionally, add the /lib
directory to Linker locations (This isn't necessary if you gave the full path to the .a in the linker settings.
Cannot compile when using libxml
You need always to keep the -I/usr/include/libxml2
in your gcc statement, so that it can find the header files.
Problem at linking libxml2 library in my C project
As @KamilCuk pointed out in the comments, I was defining incorrectly the paths in the gcc options. So the correct command that solved the entire problem was:
gcc test.c -o test -Iinclude/ -Llib/ -l:libxml2.a
header file (.h) include problems with gcc
Actually, if the libxml2
is the system one (development package), it is probably known to pkg-config
so the right way to compile and link (a single source file program) is:
gcc -Wall -g $(pkg-config --cflags libxml-2.0) \
../src/code.c \
$(pkg-config --libs libxml-2.0) \
-o App
Of course you'll need to simply #include <libxml/parser.h>
etc... as answered by alk
You really should use GNU make and have your Makefile
, see this example (to adapt to C instead of C++, so CFLAGS
instead of CXXFLAGS
and CC
instead of CXX
...)
Take the habit to always compile with all warnings -Wall
and debug info -g
at least during the development phase.
fatal error: libxml/xmlmemory.h: No such file or directory
It says CXml.h
line 6 is:
#include <libxml/xmlmemory.h>
But libxml/xmlmemory.h
is not in your include path. The include path is set with -I
options on the compiler command line.
The error is "fatal" because compilation cannot continue past that point.
Find out where that file is actually installed and make sure the path to its libxml
directory is in a -I
option. For example, if it's installed in /opt/local/include/libxml/xmlmemory.h
, then you need -I /opt/local/include
on your command line.
CModelStereoXml, CXml and xmlmemory all are files in a library (so I can't edit it)
Only the compiled code is in a library (.a
, .la
, or .so
file) that you can't edit. The headers will be located somewhere else.
Related Topics
What Do the .Eh_Frame and .Eh_Frame_Hdr Sections Store, Exactly
How to Dynamically Allocate Memory Using Assembly and System Calls Under Linux
Trace of Executed Programs Called by a Bash Script
What Is the Use of _Iomem in Linux While Writing Device Drivers
Avrisp Mkii Doesn't Work with Avrdude on Linux
Accurately Calculating CPU Utilization in Linux Using /Proc/Stat
Can't Change Tomcat 7 Heap Size
Bluetooth Low Energy: Use Bluez Stack as a Peripheral (With Custom Services and Characteristics)
Howto Prepare Qtcreator for Linux Driver & Kernel Development
How to Convert Pptx Files to Jpg or Png (For Each Slide) on Linux
Context Switch in Interrupt Handlers
Hadoop: «Error:Java_Home Is Not Set»
Linux Configure/Make, --Prefix
How to Calculate the Mean of a Column