I've installed OpenCV 4.0.0 with this command
brew install hybridgroup/tools/opencv
And I'm trying to compile simple program which loads image from filesystem into cv::Mat
.
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/core/ocl.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
int main() {
auto img = cv::imread("/Users/peter/Dektop/source.png");
return 0;
}
And I'm keep getting this error
Undefined symbols for architecture x86_64:
"cv::imread(std::__cxx11::basic_string, std::allocator > const&, int)", referenced from: _main in ccw6DQpj.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
I'm compiling with this command. GCC 8.2.0.
g++-8 main.cpp -std=c++17 `pkg-config --cflags --libs opencv4`