CMake Compiling OPENCV Error

Source: Internet
Author: User

1.
Error
CMAKEFILES/OPENCV_EXAMPLE.DIR/EXAMPLE.CPP.O: In the function ' main ':
Example.cpp: (. text+0x12c): References not defined to ' cv::imshow (cv::string const&, Cv::_inputarray const&) '
Example.cpp: (. text+0x21d): References not defined to ' cv::imshow (cv::string const&, Cv::_inputarray const&) '
CMAKEFILES/OPENCV_EXAMPLE.DIR/EXAMPLE.CPP.O: In function ' DrawText (cv::mat&) ':
Example.cpp: (. text+0x3fe): To ' CV::p uttext (Cv::inputoutputarray const&, cv::string Const&, CV::P oint, int, Double, cv::scalar_, int, int, bool) ' undefined reference
CMAKEFILES/OPENCV_EXAMPLE.DIR/EXAMPLE.CPP.O: In function ' cv::string::string (char const*):
Example.cpp: (. text._zn2cv6stringc2epkc[_zn2cv6stringc5epkc]+0x4d): Reference not defined for ' cv::string::allocate (unsigned long) '
CMAKEFILES/OPENCV_EXAMPLE.DIR/EXAMPLE.CPP.O: In the function ' cv::string::~string () ':
Example.cpp: (. text._zn2cv6stringd2ev[_zn2cv6stringd5ev]+0x14): References not defined for ' cv::string::d eallocate () '
Collect2:error:ld returned 1 exit status
Cmakefiles/opencv_example.dir/build.make:112:recipe for Target ' opencv_example ' failed
MAKE[2]: * [opencv_example] Error 1
Cmakefiles/makefile2:67:recipe for Target ' Cmakefiles/opencv_example.dir/all ' failed
MAKE[1]: * [Cmakefiles/opencv_example.dir/all] Error 2
Makefile:83:recipe for target ' all ' failed
Make: * [All] Error 2

Error Analysis:
Find_package (OpenCV [version number] REQUIRED)
Cases
Find_package (OpenCV 3.3.0 REQUIRED)

Problems can be solved
The reason may be that it was accidentally changed to another version, causing the cmake to default to other versions and cannot find the library.

2.
Call the Include <opencv2/gpu/gpu.hpp>
/usr/include/opencv2/gpu/gpu.hpp:432:error: ' Vector ' does not Name a type
Cv_exports void merge (const vector& SRC, gpumat& dst, stream& Stream = Stream::null ());
Workaround:
at the front
Plus using namespace std

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.