I am using ubuntu 12.4 g++ i'm working on libxml++ library I have included this library in my program but I am getting an error saying
libxml++/libxml++.h: No such file or directory
i also tried compiling using g++ main.cc -o main pkg-config --cflags --libs libxml++-2.6 but it is not working. I have installed the latest libraries using sudo apt-get install libxml++.
While compiling for libxml we have to use these options. pkg-config --cflags --libs libxml++-2.6 this should be in single quotation mark / Backticks ("`", grave accents), .
So the command should be like this.
$ g++ main.cc -o program `pkg-config --cflags --libs libxml++-2.6`
or go through this once. http://developer.gnome.org/libxml++/stable/
Related
I'm trying out this github repository, one of the requirements is to have opencv 3.1
when I run pip list I have opencv-python and opencv-contrib-python both version 4.7.0.68
$ g++ -std=c++11 Heartbeat.cpp opencv.cpp RPPG.cpp `pkg-config --cflags --libs opencv` -o Heartbeat
but when I run the above I get the error below
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Please use opencv4 instead of opencv. So your command will look like:
g++ -std=c++11 Heartbeat.cpp opencv.cpp RPPG.cpp `pkg-config --cflags --libs opencv4` -o Heartbeat
It should work.
I have OpenCV 4.5.1 installed in Linux. But each time I restart I have to separely provide path to the headers and linker flags. and then compile ?
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/parallels/opencv4.5-custom/lib/pkgconfig
pkg-config --cflags --libs opencv4
and then
g++ -Wall -std=c++11 -o main main.cpp $(pkg-config --cflags --libs opencv4)
I just want to run the g++ comand each time
I can compile the sample continuous.c file by this command inside Ubuntu terminal:
gcc -o continuous continuous.c -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\" `pkg-config --cflags --libs pocketsphinx sphinxbase`
But if I want to build it inside codeblocks how should I do it?
I want to develop c++ apps that use libvirt api (libvirt/libvirt.h) in Mac OS. In Ubuntu once I installed libvirt-dev, it was compiling fine. but in mac I cannot find a way to install libvirt-dev. Can someone point me to the correct path. Thanks :D
If you install homebrew first, from the Homebrew website, then you will be able to simply install libvirt with:
brew install libvirt
If you want to compile against libvirt, I would further suggest you install pkgconfig with:
brew install pkgconfig
After that you can use pkgconfig to find the switches and flags you need for libvirt like this:
pkg-config --cflags --libs libvirt
which will give you something like:
-I/usr/local/Cellar/libvirt/3.4.0/include -L/usr/local/Cellar/libvirt/3.4.0/lib -lvirt
So, in conclusion, you will then be able to compile C code with:
gcc program.c $(pkg-config --cflags --libs libvirt) -o program
or
clang program.c $(pkg-config --cflags --libs libvirt) -o program
or C++ code with:
clang++ program.cpp $(pkg-config --cflags --libs libvirt) -o program
I installed opencv on a lubuntu 12.10 distro. Then when I try to compile a code which is using opencv it says it can't find it. So I try in a terminal :
pkg-config --cflags --libs opencv
It answers me that it can't find opencv. But the files are installed in /usr/lib. I don't understand why it can't find them.
You have to put pkg-config --cflags --libs opencv at the end of your g++ line. For example :
g++ test.cpp -o test `pkg-config --cflags --libs opencv`
Compiles
g++ `pkg-config --cflags --libs opencv` test.cpp -o test
Doesn't compile and have undefined reference.
For OpenCV 4 you might have to use:
pkg-config --cflags --libs opencv4
(Note the 4 in the end!)
From OpenCV 4:
add -DOPENCV_GENERATE_PKGCONFIG=YES to cmake build arguments.
Use YES, ON is not working anymore.