using namespace std;
using namespace cv;
int main()
{
Mat testImage = imread("test.jpg");
imshow("testImage",testImage);
waitKey(0);
return 0;
}
编译显示
/tmp/cco0yCku.o: In function `main':
opencv_test.cpp:(.text+0x40): undefined reference to `cv::imread(cv::String const&, int)'
opencv_test.cpp:(.text+0x70): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
opencv_test.cpp:(.text+0x88): undefined reference to `cv::waitKey(int)'
/tmp/cco0yCku.o: In function `cv::String::String(char const*)':
opencv_test.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x40): undefined reference to `cv::String::allocate(unsigned long)'
/tmp/cco0yCku.o: In function `cv::String::~String()':
opencv_test.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to `cv::String::deallocate()'
/tmp/cco0yCku.o: In function `cv::Mat::~Mat()':
opencv_test.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x34): undefined reference to `cv::fastFree(void*)'
/tmp/cco0yCku.o: In function `cv::Mat::release()':
opencv_test.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x58): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
系统中有opencv的相关头文件和库文件,但没有opencv.pc文件,请问需要如何配置是opencv生效