小编use*_*414的帖子

OpenCV 2.3编译问题 - 未定义的反射 - Ubuntu 11.10

在此先感谢任何帮助......

系统信息:带OpenCV 2.3的Ubuntu 11.10(64位)(今天安装)

我正在尝试在OpenCV 2.3中编译一些非常简单的代码,但我得到一个奇怪的错误.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

int main(){
  cv::Mat image=cv::imread("img.jpg");
  cv::namedWindow("My Image");
  cv::imshow("My Image",image);
  cv::waitKey(0);
  return 1;
}
Run Code Online (Sandbox Code Playgroud)

但是rrrrrrrrrrrrr,我收到这些错误信息......

-SG41:~/Desktop$ g++ `pkg-config opencv --cflags --libs` -o test_1 test_1.cpp 
/tmp/ccCvS1ys.o: In function `main':
test_1.cpp:(.text+0x44): undefined reference to `cv::imread(std::basic_string<char,    std::char_traits<char>, std::allocator<char> > const&, int)'
test_1.cpp:(.text+0x8e): undefined reference to `cv::namedWindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
test_1.cpp:(.text+0xbc): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
test_1.cpp:(.text+0xf0): undefined reference to `cv::imshow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
test_1.cpp:(.text+0x112): undefined reference to `cv::waitKey(int)'
/tmp/ccCvS1ys.o: In …
Run Code Online (Sandbox Code Playgroud)

c++ ubuntu opencv g++

38
推荐指数
1
解决办法
5万
查看次数

标签 统计

c++ ×1

g++ ×1

opencv ×1

ubuntu ×1