undefined reference to `cv::imread(std::string const&, int)'

Ubuntu下编译一个C++文件,C++源程序中使用了opencv,opencv的安装没有问题,但是在编译的过程中出现如下错误:

undefined reference to cv::imread(std::string const&, int)' undefined reference tocv::noArray()’
undefined reference to cv::_OutputArray::_OutputArray(cv::Mat&)' undefined reference tocv::_InputArray::_InputArray(cv::Mat const&)’
undefined reference to cv::imwrite(std::string const&, cv::_InputArray const&, std::vector > const&)' undefined reference tocv::_InputArray::_InputArray(cv::Mat const&)’
undefined reference to cv::imshow(std::string const&, cv::_InputArray const&)' undefined reference tocv::waitKey(int)’

g++ getmask.cpp -o getmask pkg-config opencv --cflags --libs

你可能感兴趣的:(计算机视觉,opencv,undefined)