Hello World in OpenCV (compiling and linking from source on Ubuntu) - c++

I'm trying to compile OpenCV from source and create a test C++ program which uses the newly compiled OpenCV library.
Compiling OpenCV appears to work, I followed this guide.
But now I want to create a test program which uses the library.
I followed this guide, but and everything appeared to work until I tried the command:
./DisplayImage lena.jpg
Which gave me the following error
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you
are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then
re-run cmake or configure script) in cvNamedWindow, file
/media/chris/Archive2/Archive/Programming/OpenCV/sav/opencv/modules/highgui/src/window.cpp,
line 550 terminate called after throwing an instance of
'cv::Exception' what():
/media/chris/Archive2/Archive/Programming/OpenCV/sav/opencv/modules/highgui/src/window.cpp:550:
error: (-2) The function is not implemented. Rebuild the library with
Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,
install libgtk2.0-dev and pkg-config, then re-run cmake or configure
script in function cvNamedWindow
Aborted (core dumped)
the mentioned packages appear to be installed
I've tried rebooting my computer after installing the packages and I still get the same message.

Solved it
Looks like I was missing some of the packages mentioned in http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
even though libgtk and pkg-config were installed

Related

How I install wxWidgets in msys2 correctly?

I'm having trouble installing wxWidgets in msys2, I used pacman to install the library
pacman -S mingw-w64-clang-x86_64-wxwidgets3.0-msw
But when I try to execute a test file it gives me this error
fatal error: wx/wx.h: No such file or directory
Reading online I see that are in another methods of installing the library you have to compile it, but I can't find any information in regards to installing it with pacman.
I also tried to compile it myself with Cmake following the instructions in the wxwidgets page but I failed and I want to see what should I do now.
What I need to do to get this to work?

Boost MPI flags can't be found when installing Repast HPC

Using M1 Mac, I've followed the manual install procedures to install Repast HPC.
I'm trying to run ./install.sh rhpc and the following error persists:
configure: error: cannot not find the flags to link with Boost mpi
The suggested solution says to add the compiler wrappers with the following commands:
export PATH=$BASE_DIR/MPICH/bin:$PATH
MPI_COMPILER_INVOCATION=$BASE_DIR/MPICH/bin/mpicxx
which didn't work as the command mpicxx still couldn't be invoked.
So I tried installing mpich through homebrew, where mpicxx now works outside of the install. However, the error persists.
So I tried installing boost through homebrew and directing the install to the homebrew directory, but the error persists.
So I tried installing open-mpi through homebrew, and mpicxx still works, but the error persists.
Any suggestions? I'm running out of online resources to solve the issue.

After installing a Library through conda, compiling a C++ script, won't see its headers files

I have already compiled a Script on my Desktop Computer, but now I have to compile it on a Server where I don't have root access.
So I chose to install Anaconda and work with Conda environments.
So, I'm installing a GCC 9.3 Compiler, among with a GXX 9.3 Compiler because I need the execution policies from C17++.
I also installed GSL library through conda install gsl and indeed, on conda list it appears to be:
gsl 2.4 h14c3975_4
so, I decided to compile the script via : x86_64-conda_cos6-linux-gnu-cpp SCRIPT_NAME -o _OUTNAME_ -lgsl since this is the way Anaconda says to call it's compilers (said so on build log)
but I get this error:
mpi_final.cpp:1:10: fatal error: gsl/gsl_math.h: No such file or directory
1 | #include <gsl/gsl_math.h>
| ^~~~~~~~~~~~~~~~
compilation terminated
I have managed to include GSL but ONLY when I install it manually. and then I have problem with other libraries, so I decided to fix anaconda environments. But I dont know how to proceed.
Any Idea on where to look?

OpenCV trying to use windows to show image throws exception

I´m trying to create named windows and show an image from them using OpenCV in c++. When I try it, I will get an error saying:
The function is not implemented. Rebuild the library with Windows,
GTK+2.x or Cocoa support. If you are on Ubuntu or Debian, install
libgtk2.0-dev and pkg-config, then re-run cmake or configure script in
function 'cvNamedWindow'.
I´m on a raspberry pi using Ubuntu MATE and I didnt have this problem when I was testing on my laptop using Ubuntu. I have checked that all neccessary libraries are installed. So I run cmake again to recompile it, but it still doesn t work.
Is there something different I need to do for Ubuntu MATE? Or is there something else I should try?

fatal error: yaml-cpp/yaml.h: No such file or directory

I am trying to compile my own c++/qt5.2 app which uses yaml-cpp under Ubuntu 14.04.
While issuing the make command I get the following error
fatal error: yaml-cpp/yaml.h: No such file or directory
on the line:
#include <yaml-cpp/yaml.h>
How can I fix this?
You need to install the yaml-cpp library.
Under Ubuntu 14.04 you can do this by simply running one of the following commands in a terminal window (depending one the API you use):
sudo apt-get install libyaml-cpp-dev
or
sudo apt-get install libyaml-cpp0.3-dev
See the yaml-cpp project page for other operating systems and differences between old (0.3) and new API.