Opencv Xcode Linker Error for MacOSX - c++

XCode version: 8.2.1
Opencv version :3.2
Apple Mach-O Linker Error
ld: library not found for -ltcl8.6
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Am trying to run a simple Hello World program in opencv. I followed this tutorial https://blogs.wcode.org/2014/11/howto-setup-xcode-6-1-to-work-with-opencv-libraries/
http://tilomitra.com/opencv-on-mac-osx/
I do not know what the error is actually aiming at. Thanks in advance.

I have had the same issue and I will explain you the different steps to solve this problem
Download source of the last opencv on Github.
Download the last version of cmake Cmake download link and install it.
Go to the opencv folder and create a directory named build.
Go to build directory.
Don't forget to add cmake to the path :
sudo mkdir -p /usr/local/bin
sudo /Applications/CMake.app/Contents/bin/cmake-gui
--install=/usr/local/bin
Launch the command :
cmake -G"Unix Makefiles" ../
After you have to compile :
make -j8
And to install it :
sudo make install
Open Xcode and set on your project in build settings : "Header search path" : "/usr/local/include"
"Library search path" : "/usr/local/lib"
On your project, right click and choose "add files to your project name"
Go to the directory "Opencv/build/lib" and select all ".dylib" files.
Now, you can use OpenCV 3.2 with the last version of Xcode.
Let me know, if you have another issue.

Related

How to build gstreamer from source code using meson?

OS: Windows 10
Compiler: gcc x86-64 8.1.0
I cloned repo:
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git
Started meson:
meson \path\to\directory
And next start ninja
ninja
And I get error:
fatal error: glib.h: No such file or directory
I thought that everything what I need is in this repo. Am I wrong?
I guess meson outputs "glib2 not found".
You might need to install glib2.
And make sure glib-2.0.pc exists on "/usr/local/lib/pkgconfig" or $PKG_CONFIG_PATH dir.
meson search pkgconfig dir first for find out package.

unable to determine what cmake generator to use-VS Code-Windows 10

while compiling cpp files in vs code in windows 10 PC, after giving "cmake:debug" I get error like this "unable to determine what cmake generator to use.please install or configure a preferred generator or update settings.json, your kit configuration or path variable"
how to solve the error
If you have install cmake, setted up your project and you added it's path, try this Ctrl+shift+P and Type "cmake:reset cmake tools for extension state" and press enter.
At least that works for me.
Firstly check the system.
Install MINGW https://www.msys2.org/
Install gcc, g++, gdb, and cmake using pacman.
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-cmake
Check installation:
gcc --version
g++ --version
gdb --version
Edit environment variables for your account (PATH)
C:\msys64\mingw64\bin
For cmake project on Vscode:
Create a cmake project: https://code.visualstudio.com/docs/cpp/cmake-linux#_create-a-cmake-project
Choose the Kit (Toolchain) which was installed before
Set cmake.cmakePath (If you installed with pacman, the path should be same as gcc/g++.
"cmake.cmakePath": "C:\msys64\mingw64\bin\cmake.exe"
Reset VScode: Ctrl+shift+P and type "CMake:Reset CMake Tools for Extension State"
Configure project: Ctrl+shift+P and type "CMake: Configure". You will see "built" directory and generated files.

Unable to run C++ cmake project in Clion [duplicate]

I'm trying to make CLion use the same version of CMake that I'm using from the command line. In Preferences > Build, Execution, Deployment > Toolchains, I tried setting a custom CMake executable path to /usr/local/Cellar/cmake/3.7.0/bin, but CMake displays a "not found" error on the same page.
For now, I had brew install the same version of CMake that CLion is using: brew switch cmake 3.6.2
But is there a way to make CLion use the version of cmake installed with brew?
Yes, you can set your own cmake binary for use in Clion.
You're on the right track, go to Preferences > Build, Execution, Deployment > Toolchains just as you did, and set CMake executabl -> Custom to
/usr/local/Cellar/cmake/3.7.0/bin/cmake
Note, your're supposed to put the absolute name of your own cmake here, not only the path to the directory containing cmake.

Fatal error: opencv2/sfm.hpp: no such file or directory #include <opencv2/sfm.hpp>

I'm a beginner with opencv library. I've installed it on Ubuntu 17.04 and everything during the installation was perfect, no error at all.
I've installed the Opencv-master, builded it, then I downloaded the opencv_contrib-master and added it to the build folder.
I'm trying to build the scene_reconstruction using SFM (structure for motion). I've installed all the dependencies with:
sudo apt-get install libeigen3-dev libgflags-dev libgoogle-glog-dev
Then I've installed the Ceres Solver:
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
mkdir build && cd build
cmake ..
make -j4
make test
sudo make install
Everything was ok, no error at all.
I tried to write the example_sfm_scene_reconstruction.cpp following the official documentation from here (Tutorial Scene Reconstruction).
With cmake . there weren't any errors but when I try to do make I've this error:
screenshot
The english version is fatal error: opencv2/sfm.hpp: no such file or directory #include
Maybe the path is not correct or I don't know what to think.
Thanks!
You have to build the OpenCV Release together with the Contrib Release. To build OpenCV with the Contrib Repository you will have to add a parameter to cmake:
cd <opencv_build_directory>
cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
make -j5
I recommend getting a stable opencv version (e.g. 3.3.1) as opposed to checking out the master branch. Make sure that contrib is the same version. If you are unsure at all, just follow the instructions here:
https://github.com/opencv/opencv_contrib
Also, you will need the dependencies for the sfm module before compiling opencv.

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles"

I am trying to use cmake to build the Box2D library for c++. When I run cmake gui I get the error:
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
Most questions like these people have answered by saying "Add MinGw/bin to the PATH" but I already have that on the PATH. What else could be causing this error?
mingw32-make.exe can be installed with the standard MinGW32 installer via the appropriate checkbox:
As rubenvb points out, you'll still need to ensure that it makes it into your PATH. If you edit your environment variables via System Properties, be sure to close and reopen the CMake GUI.
If you're more accustomed to using make.exe, install MSYS and use MSYS Makefiles as the CMake generator. You'll also need to put both mingw\bin and msys\1.0\bin into your PATH.
I had the same problem and I added these three to my system path and errors were solved.
C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin
C:\Program Files\CMake\bin
C:\opencv\build\install\x64\mingw\bin
You can check this answer: https://stackoverflow.com/a/74240235/3110429
Firstly check the system.
Install MINGW https://www.msys2.org/
Install gcc, g++, gdb, and cmake using pacman.
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-cmake
Check installation:
gcc --version
g++ --version
gdb --version
Edit environment variables for your account (PATH)
C:\msys64\mingw64\bin
For cmake project on Vscode:
Create a cmake project: https://code.visualstudio.com/docs/cpp/cmake-linux#_create-a-cmake-project
Choose the Kit (Toolchain) which was installed before
Set cmake.cmakePath (If you installed with pacman, the path should be same as gcc/g++.
"cmake.cmakePath": "C:\msys64\mingw64\bin\cmake.exe"
Reset VScode: Ctrl+shift+P and type "CMake:Reset CMake Tools for Extension State"
Configure project: Ctrl+shift+P and type "CMake: Configure". You will see "built" directory and generated files.
In the path MinGW\bin try to find make.exe or mingw32-make.exe. If you don't have it then mingw32-make.exe can be installed with the standard MinGW32 installer as shown in the pervious answer.
Then have a second copy of make.exe or mingw32-make.exe to have identical two files with those names make.exe and mingw32-make.exe
and it solved my problem.