I have installed OpenCV via homebrew, for my Mac OSX.
The problem I am having is that I am unable to use the imread
openCV command at all. When I do, I get an error. Here is a breakdown of what I have done.
My simple code is:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat imageMe = imread("frog.jpg", 0);
return 0;
}
To compile, I type this into the command prompt:
g++ opencvEntry.cpp -o opencvEntry `pkg-config --cflags --libs opencv` && ./opencvEntry
Upon doing that, the error message I get is:
Undefined symbols for architecture x86_64:
"cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
_main in ccvT5f6R.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
So... I am not sure where/what is going on here. If I simply uncomment the imread
line the file compiles just fine. However when uncommented, it does not recognize the command.
What is going on here?