Opencv windows 7 cmake mingw-32 make error - c++

I wanted to ask about an error I got when compiling opencv for windows7, I am following this
http://www.laganiere.name/opencvCookbook/chap1s1_2.shtml
and I have gotten to the part where both configure and generate commands on cmake are successful, but
when using mingw32-make command in the directory where cmake builds opencv, I am getting the following error:
fatal error: QApplication: No such file or directory
this happens in the file windw_QT.h which is located on the sources folder in openc, my exact path is
C:\Users\lenovo\Desktop\OpenCV248\opencv\sources\modules\highgui\src\window_QT.h
to be honest I could handle the cmake errors when it didn't know where to find the QT libraries, but I have no idea why compiling the sources yields this error, isn't QApplication supposed to exist in the very same folder as highgui.h

Based on your comment, you seem to have used cmake 2.6 for dealing with Qt 5. If you take a look at the Qt 5 cmake manual, you can see that you would need at least 2.8.3, but 2.8.11 is recommended:
CMake is a 3rd party tool with its own documentation. The rest of this manual details the specifics of how to use Qt 5 with CMake. The minimum version required to use Qt5 is CMake 2.8.3, but 2.8.11 is recommended.
Once you update, this all should start working.

Related

CMake: Cannot open shared object file: No such file or directory

I would like to create a CMake project using cmake -i interactive mode, but came across the error:
cmake: error while loading shared libraries: libidn2.so.0: cannot open shared object file: No such file or directory
I've been following the tutorial https://learnopengl.com/, but use Manjaro Linux instead of Windows, so wanted to use the command line as explained in https://cmake.org/runningcmake/
On research, most examples suggested adding to the LD_LIBRARY_PATH. I attempted this, locating libidn2.so at /usr/lib and adding it to the relevant path. It had no affect whatsoever however.
Next I attempted uninstalling CMake in the package manager, and curiously the command still gave the same error message, even though given it was uninstalled, CMake should not be recognized as a command at all.
I have had problems with CMake on my machine in the past, having been unable to install and link the CGAL library using CMake, so it may be a symptom of a wider issue.
I found a solution to the problem after using which cmake. Turns out there was another set of the cmake commands that came with the operating system I found in /usr/local/bin/cmake.
It was solved by deleting the command files in this location, so the command files of the actual installation were run instead, which functioned correctly.

SFML headers not found when compiling using CMake and GCC (MacOS Sierra)

I have been trying to use SFML in a CMake project, specifically the header SFML/Audio.hpp. I installed SMFL using Homebrew, and both the .dylib-files and the headers should be located correctly, in /usr/local/lib and /usr/local/include, respectively.
Now running CMake works fine, telling me that it has Found SFML 2.4.2 in /usr/local/include.
However, when compiling the project (using make), I get the following error:
/path/to/project.hpp:12:10: fatal error: 'SFML/Audio.hpp' file not found.
Does anyone know why this is happening?
Note: Compiling works fine for colleagues of mine using the same CMake- and source files on various Linux operating systems.
This sounds like you simply forgot to add SFML's include directory. On Linux, they probably install SFML to some system path where GCC (or Clang) look by default, so they don't need any additional CMake directives.
Luckily, fixing this is pretty simple.
Add the following line to your CMakeLists.txt somewhere before defining targets:
include_directories(${SFML_INCLUDE_DIR})
The variable SFML_INCLUDE_DIR is populated when you successfully call find_package(SFML...).
While you're at it, you might also want to ensure to link to the proper library files in the correct order:
target_link_libraries(myTargetName ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
Again, both variables are populated automatically.

Qt-GStreamer: PKGCONFIG not found

I am pretty new to setting the Qt Creator environment in Linux.
I will cross compile this demo program to the Yocto Project i.MX6. This demo program needs to use Qt-GStreamer
in demo.pro
There is these 2 lines
CONFIG += link_pkgconfig
PKGCONFIG += Qt5GLib-2.0 Qt5GStreamer-1.0 Qt5GStreamerUi-1.0 Qt5GStreamerUtils-1.0 Qt5GStreamerQuick-1.0
at compile in the Desktop, it shows
error: Qt5GLib-2.0 development package not found
This applies to all the other packages as well.
I know that it tells me that I am missing the package for the Qt Gstreamer.
However, when I look at this thread, the answer is
export PKG_CONFIG_LIBDIR=/home/anisha/Desktop/newGSTr/qt-gstreamer-0.10.3/lib/x86_64-linux-gnu/pkgconfig
But, from what I have downloaded in Qt Binding-GStreamer qt-gstreamer-0.10.3 Does not have the lib folder inside.
I have also used cmake to work with the CMakeList.txt inside the folder but encounter Qt missing packages error.
Could someone help me on setting up those packages?

Trouble building the Open Asset Import Library (Assimp)

I have just downloaded the Open Asset Import Library (Assimp) which is an API used to import 3D file formats such as .3DS and .Obj into source code. Doing so allows for much easier rendering of meshes using openGL.
The problem is, I can't get the Library to build. It comes with very vague and cryptic directions on how to build it and connect to a compiler such as XCode (which I am using). It says I should use a program called CMake to build the library. I have downloaded CMake and tried to use it but it has not yet worked for me.
Has anyone here successfully built and installed Assimp using CMake or some other tool?
I totally agree that the documentation for Mac is a bit lacking, but I have managed (after several attempts) to build and install the library.
A few things before starting: make sure you have installed XCode Command Line Tools (that installs the GNU compiler).
These are the steps I followed:
Download the latest release of Assimp and extract it (I got the file
from here, the one with source only:
http://sourceforge.net/projects/assimp/files/assimp-3.0/)
If you don't have it, install CMake (http://www.cmake.org/cmake/resources/software.html; I'm currently using an older version, but the latest one should work fine as well)
Create a build directory (should be outside the source directory)
Open CMake and point it to the folder you created at step 1 (where it says "Where is the source code"); the other folder ("Where to build the binaries") should point to the folder created at step 3
Click "Configure" on the bottom; it will ask you which environment you'd like to use. I picked "Eclipse CDT 4 - Unix Makefiles"
You should get a list of options; the two I selected were "BUILD_STATIC_LIB" and "ENABLE_BOOST_WORKAROUND"
Click "Generate"
Now you should move to the terminal and go to the folder created at step 3
Type "make" and launch it; you should see the build progressing without issues
When the build is finished, type "sudo make install"; it will ask for your password and install the library
After the last step you should be able to include the library in your code:
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
Make sure you also include the library for linking; when linking you should add -lassimp to the list
Let me know if you have any issues with the steps above!
I had a slightly different approach that worked for me building assimp on Mac. Here are the steps that I took if it helps anybody.
Step 1 - Install Libraries with Homebrew
brew install glm glew assimp
Step 2 - Update my CMake with the Following
FIND_PACKAGE(ASSIMP REQUIRED)
LINK_DIRECTORIES(/usr/local/lib)
add_executable(
myExecutable
...
)
TARGET_LINK_LIBRARIES( myExecutable PRIVATE ${ASSIMP_LIBRARIES} )

Bullet Physics, CMake->CodeBlocks - MinGW: Doesn't find GL/glut.h?

Statistics...
My System: Windows Vista 64 bit
Library: Bullet Physics v2.78
Makefile Generator: CMake
Build system: MinGW command line, MinGW + CodeBlocks
Makefiles were implemented by command line and through CMake-generated Code::Blocks project
In both cases, the build fails near 30%. NOTE: I did have to switch the build executable in the Code::Blocks project from make.exe to mingw32-make.exe
First Failure: Demos\OpenGL\GLDebugFont.cpp -> GL/glut.h: No such file or directory
Second Failure (after commenting out the #include from the first) -> Demos/OpenGL/GlutStuff.h: same error
These failures happen when I build command-line OR through the generated C::B project.
Why can't it find GL/glut.h? "bullet-2.78\Glut\GL\glut.h" exists. Maybe there's a way I can tell it to find glut there?
NOTE: During the CMake makefile generation, CMake did tell me that "You are using the obsolete GLU package, please use OpenGL instead." It continued as normal with the Makefile generation. Maybe I need to define some environment variables? Maybe I need to configure something in Windows that CMake is looking for?
I would add a compiler search path in bullet-2.78/Glut, but Code::Blocks doesn't allow that if you're using a custom makefile (like a CMake-generated one).
UPDATE: I have been able to build the library itself, by building specific targets in the Code::Blocks project. However, I have been unable to build any of the demos or the benchmark test, since they all use OpenGL (and apparently glut.h). I would still like to compile those.