How can I compile and build a program using external library with command line tools come with Xcode?
Question
I am coding a computer vision program, which is using OpenCV 2.4, by Xcode 4.4. I want to compile and make it in the Terminal by g++ or make command. But the system shows a lot of errors that the compiler cannot find the "opencv2/opencv.hpp" file and Vec3d, etc..!
My question is how to configure the system the I can make and build the code in Terminal? Thanks.
Solution
First, you need to have command line tools (I guess you already have it)
- Bring up Preference in Xcode
- Select "Downloads" tab
- Select "Components' tab
- Click 'install' on the command line tools line.
Then, you need to install OpenCV. I suggest to use Homebrew
- setup homebrew, then
brew install opencv
It will install library in /usr/local, which is in g++'s standard lookup path, thus should be ok.
If you still need help, post the log file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow