Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DisplayImage.cpp errors Using OpenCV with gcc and CMake

Hi:

I've had issues in compiling DisplayImage.cpp, I've followed the tutorial here and to create a cmake file and generate executables, however, when I was compiling the problem with make it displays the following errors:

Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in DisplayImage.cpp.o
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in DisplayImage.cpp.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
_main in DisplayImage.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [DisplayImage] Error 1
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
make: *** [all] Error 2

I am using MacOS could anyone please help!

Thanks