I hope someone can help me. I have a c++ file which use opencv libraries.
I need to get an executable for an ARM in which I have to run it. My executable should be compile in a static linker way.
I am not an exepert so sorry If I am doing something weird, I follow this steps:
I download the opencv for ARM libraries, I build it with the cmake and I got the statics opencv ARM libraries without problems.
Then I try to compile my c++ file like this:
arm-linux-g++ -static -o exampleWindows IPCamera.cpp `pkg-config --cflags --libs opencv`
And it works, so I got an executable, I write:
file executable
And I get this output:
ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, not stripped
So it seems that is ok, is an ARM format and is a static linked. But when I try to run this executable in my ARM is comming this 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 /home/jesus/opencv/opencv/modules/highgui/src/window.cpp, line 483
terminate called after throwing an instance of 'cv::Exception'
what(): /home/jesus/opencv/opencv/modules/highgui/src/window.cpp:483: 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
Then how I am not an expert I tried to follow what the error message says, so I donwload the libgtk2.0 in my ubuntu, and then I make again the cmake and make for build the ARM static libraries, but nothing is solved.
So I need some help with this error, or tell what is the meaning, because it seem that is simple but I do not know what to do.
Here is my code:
#include <iostream>
#include <pthread.h>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv/highgui.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
using namespace std;
using namespace cv;
int main()
{
cout<<"ready"<<endl;
cv::Mat frame;
cv::namedWindow("front", CV_WINDOW_NORMAL);
cvMoveWindow("front", 0, 0);
cvSetWindowProperty( "front", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
return 0;
}
Thank you so much I hope someon could help me.
The problem is that you need to rebuild OpenCV with the GTK-support activated. The necessary steps are:
Install gtk (sudo apt-get install libgtk2.0-dev, I think you did this already ;) ).
Rebuild OpenCV:
If you installed it from the repositories, re-install it (I think this is not the case).
If you manually built OpenCV from source code: run cmake with it again, making sure that the option WITH_GTK is marked (you can use the CMAKE GUI to activate that option).
Once the Makefiles have been re-generated with CMAKE, run make, make install and don't forget ldconfig.
Try again with your code ;)
Hope that it helps!
The problem is due to the fact that, you did not enable the GTK+ library support .
To enable it
1)install the GTK+ Libraries, if you don't have them
2) re build the libraries with including this -DWITH_GTK=ON
hope that this will work...
run ccmake . and enable WITH_GTK and WITH_GTK_2_X
run make && make install
ldconfig
Related
Recently I wanted to profile my cpp code and came across gperftool, but there aren't really clear instructions on how to use it with Mac. So far I have run brew install gperftools and wanted to compile my simple cpp file which just outputs "Hello world!". I run g++ main.cpp -lprofiler -o main but get error ld: library not found for -lprofiler. I really appreciate it if you could guide me or should me a tutorial where it's easy to follow. Thanks :)
Edit: Currently I am using MacOS with new M1 chip (not sure if that can cause any issue)
So brew didn't install the binaries and that's it.
Follow these steps if you are having a hard time making it work
clone https://github.com/gperftools/gperftools
run ./autogen.sh
run ./configure
make && sudo make install
you should see some path where the binaries where installed, if you wanna take a look at it to make sure (mine was /usr/local/lib)
Profit
I found you can also use the -L$(brew --prefix gperftools)/lib flag to tell g++ where to look for the libraries if you don't want to install with make.
Dear programmers and developers,
I really want to try out GTK+ 3 on windows. Therefore, I read the official GTK+ download explanations at https://www.gtk.org/download/windows.php and installed everything with MSYS2.
Now I have a lot of files in my mingw64 subdirectory of my MSYS2 folder.
The question: How do I include all of them right? How do I link to GTK+ with all it's dependencies? I know there is a magic pkg-config attribute for the Linux C/C++ compiler, but unfortunately I am really not interested in compiling my projects in MSYS2. I am willing to use a simple MinGW (64) compiler.
Can anybody help me using the .a's, .h's and .dll'a that MSYS2 generated with a simple MinGW 64bit compiler for a stupid C++ project?
It would make me extremely happy!
Darth Moon
€edit: I actually have downloaded a precompiled GTK+ version from https://www.dropbox.com/sh/8d1qbh5dsp044on/AAB63l5I1eZks-QqjH6HXUJHa. Unfortunately, it is only 32bit but I will soon try to compile the whole GTK+ project on myself like this guy at https://github.com/Wesley-Chan/GTK-for-Windows did.
But if anybody has any idea how to build GTK+ in a smooth way under windows (especially for 64bit), please let me know! I really enjoyed the GTK+ example application and I really want to make my own ones!
I was able to successfully compile a GTK3 program in a MinGW 64-bit shell from MSYS2. First I installed the GTK3 package:
pacman -S $MINGW_PACKAGE_PREFIX-gtk3
Then I compiled the first example program from this page using the following command:
gcc test_gtk.c $(pkg-config gtk+-3.0 --cflags --libs)
Then I ran ./a.exe and it created a window.
If you are getting "undefined reference" linker errors, it means your Makefile is not linking your program to all of the correct libraries, or the order of the inputs to the linker is wrong.
Using Ubuntu 16.04 LTS
I have cloned a repo that has nice software in it, however, I can't
find any valid instructions for solving the following issue.
When I try and build the software it sayes.
main.cpp:12:19: fatal error: glfw3.h: No such file or directory
I assume I need to install glfw3, also "locate glfw3" etc. returns nothing. My main.cpp program has this in it "#include "
How do you fix this ?
Thanks,
this may help
sudo apt-get install libglfw3 libglfw3-dev
and while including
#include <GLFW/glfw3.h>
$ apt-cache search glfw3
libglfw3 - portable library for OpenGL, window and input (libraries)
libglfw3-dev - portable library for OpenGL, window and input (development files)
libglfw3-doc - portable library for OpenGL, window and input (documentation)
So, just apt-get install it.
This approach shall be standard for any Ubuntu user.
I'm trying to learn how to use KDevelop on my Ubuntu 16.04 to write C++ code, and I installed it by doing this
sudo apt-get update
sudo apt-get install kdevelop
but after it is done installing and I'm trying to make a new project, and the lines at the top that says
#include <QtGui/QApplication>
and
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>
are all returning errors saying that the included files are not found? And ask me to add a custom include path. I checked my KDevelop version on the terminal and it says I have Qt, or at least I think that's what it meant.
~$ kdevelop --version
Qt: 4.8.7
KDE Development Platform: 4.14.16
KDevelop: 4.7.3
But then when I run
~$dpkg --list libqt4-dev
~$dpkg --list libqt4-core
~$dpkg --list libqt4-gui
and it says none of them are installed. I'm so confused. Do I have the right Qt or not? How do I get KDevelop to find the correct Qt path? Should I maybe just install all the libqt4-whatever and try again?
Remember to distinguish between libraries that allow you to run a software and developer versions that allow to build new sotfware. Output of kdevelop --version states versions of the libraries which are used to run the application. In your system you are missing qttools5-dev with its dependencies.
By the way, maybe you will try qtCreator? It is an IDE developed by Qt team, and if you install it just by apt install qtcreator than you will have all necessary dev libs.
I have a process I have been using for a number of years to cross compile applications for the beaglebone black. the download I last was using was
gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linix
I have several programs that worked, but I recently got more creative so I decided to upgrade to a new toolchain, so I downloaded and installed:
gcc-linaro-5.2-2015.08-x86_64_arm-linux-gnueabihf
Now even the simplest file will not compile.
The compiler claimed that it could not find features.h.
I thought that that was probably a file that came from the beaglebone. Sure enough, so I brought it in from the beaglebone and now it complains that it can't find bits/predefs.h. That file is also on the beaglebone but I seriously doubt that this is what I am supposed to do.
Is there a way to solve this issue?
I am using Ubuntu 14.04 LTS on a 64 bit OS.
Edit more detail:
if my program does nothing but
#include <iostream>
int main()
{
return 0;
}
the output from make is
/usr/local/arm/arm-linux-gnueabihf/include/c++/5.2.1/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
if I comment out the #include
the output is:
arm-linux-gnueabihf-g++ -L/usr/local/lib/arm -L/usr/local/arm/lib -o "FTDTest" ./src/FTDTest.o
/usr/local/arm/bin/../lib/gcc/arm-linux-gnueabihf/5.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/usr/local/arm/bin/../lib/gcc/arm-linux-gnueabihf/5.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/usr/local/arm/bin/../lib/gcc/arm-linux-gnueabihf/5.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
Solution:
The problem was the sysroot from the toolchain was not pointing to the correct directory. Since I can't change the sysroot without rebuilding the toolchain I moved the directories for the sysroot to the directory the sysroot was pointing to and it works like a charm. It's not the best solution but it will let me get by.