How to develop libvirt C++ apps in Mac OS - c++

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

Related

No package 'opencv' found

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.

WxWidgets with Mingw wx/msw/libraries.h: not found

I'm using Debian 11, I installed Mingw and built WxWidgets with the following command:
../configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-ming32 --build=x86_64-linux --with-msw && make && sudo make install
And I'm using the following command to build:
x86_64-w64-mingw32-g++ wx.cpp `wx-config --cxxflags --libs std,aui`
I receive the following error:
wx/msw/libraries.h: not found
But file exists at: /usr/x86_64-w64-mingw32/include/wx-3.2/wx/msw/libraries.h
Where am I going wrong?
PS: I don't use any kind of IDE.
Friends, it finally worked, that's what you said above, the wx-config that is linked to the terminal, is only for linux, what was with the compilation for Windows inside /usr/x86_64-w64-mingw32/bin /wx-config.
When I want to compile for linux I pass:
g++ wx.cpp `wx-config --cxxflags --libs std,aui`
When I go to Windows I pass:
x86_64-w64-mingw32-g++ wx.cpp `/usr/x86_64-w64-mingw32/bin/wx-config --cxxflags --libs std,aui`
PS: I had to copy some dlls to the application folder, but it all worked out.
Thank you very much for everyone's patience.

Permantly provide path to the headers and linker flags in OpenCV Linux

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

How to add files to build "pocketsphinx" in codeblocks?

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?

libxml++/libxml++.h: No such file or directory

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/