I doing this
tar xvzf opencv-2.4.6.1.tar.gz
* Navigate to extracted folder `cd path/to/folder`
* Create a build directory and build opencv with the following commands
mkdir build
cd build
cmake -G "Unix Makefiles"...
* Make and install
make -j8
sudo make install
```
Set up an OpenCV project in XCode
- Start XCode
Create new "Command Line Tool" project with type
C++
screenshotAdd OpenCV to your project
- Right click your project on the sidebar, select "Add files to..." screenshot
- When the file chooser dialog opens up, press
cmd
+shift
+G
and enter "/usr/local/lib" screenshot - Select the required OpenCV files (named in the format
libopencv_*.dylib
), or select all. PressAdd
orReturn
screenshot - You will see that all selected files are now in the sidebar. You can youp them together by creating a new _Group_ and dragging the files in there. screenshot
- Configure your project
- Click on the project (in the side bar), and you should see the Project settings come up in the middle of the editor
- Click the
All
view (top left corner) - In the search bar type "Header Search Paths", double click the value, remove the existing entries and add
/usr/local/lib
and/usr/local/include
screenshot - Now search for "Library Search Paths" and replace the values with
/usr/local/lib
- Search for "C++ Standard Library" and select "libstdc++ (GNU C++ Standard Library)" screenshot
- Try the configuration
- Run one of the sample OpenCV projects
When I try compiling always showing an error
clang: error: linker command failed with exit code 1 (use -v to see invocation)