Unable to execute the sample program
I am facing undefined reference error while executing opencv_version.cpp. The command I am using is
g++ -ggdb -std=c++11 opencv_version.cpp -o /tmp/opencv_version 'pkg-config --cflags --libs opencv4'
.
and the CMAKE
command I am using is
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/ubuntu/opencv-4.0.0/build -D INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/opencv_contrib-4.0.0/modules ../
Below are the set of errors I am facing.
/tmp/ccoM18qB.o: In function `main': /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:13: undefined reference to `cv::CommandLineParser::CommandLineParser(int, char const* const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:14: undefined reference to `cv::CommandLineParser::about(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:15: undefined reference to `cv::CommandLineParser::has(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:17: undefined reference to `cv::CommandLineParser::printMessage() const' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:19: undefined reference to `cv::CommandLineParser::check() const' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:21: undefined reference to `cv::CommandLineParser::printErrors() const' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:23: undefined reference to `cv::CommandLineParser::has(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:25: undefined reference to `cv::getBuildInformation[abi:cxx11]()' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:13: undefined reference to `cv::CommandLineParser::~CommandLineParser()' /home/ubuntu/opencv-4.0.0/samples/cpp/opencv_version.cpp:13: undefined reference to `cv::CommandLineParser::~CommandLineParser()' collect2: error: ld returned 1 exit status
I have gone through some sites all were mentioning about using the above command but its of no use.
helo, please be so kind and change the screenshot to a TEXT version, thank you.
I have changed to text and even updated with the CMAKE command