Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 对某些opencv函数的未定义引用_C++_Eclipse_Opencv_Linker - Fatal编程技术网

C++ 对某些opencv函数的未定义引用

C++ 对某些opencv函数的未定义引用,c++,eclipse,opencv,linker,C++,Eclipse,Opencv,Linker,我正在尝试编译Ubuntu 14.04环境中opencv示例附带的'motemple.c'。我认为opencv已经正确安装;大多数程序都按预期运行。但是,在编译上述文件时,会针对多个函数引发错误“undefined reference”。以下是汇编的结果: Building target: ACTION_detection1 Invoking: Cross G++ Linker g++ -L/usr/local/lib -o "ACTION_detection1" ./opencvexampl

我正在尝试编译Ubuntu 14.04环境中opencv示例附带的
'motemple.c'
。我认为opencv已经正确安装;大多数程序都按预期运行。但是,在编译上述文件时,会针对多个函数引发错误“undefined reference”。以下是汇编的结果:

Building target: ACTION_detection1
Invoking: Cross G++ Linker
g++ -L/usr/local/lib -o "ACTION_detection1"  ./opencvexample/MotionSegmentation.o   -lopencv_core -lopencv_photo -lopencv_videoio -lopencv_videostab -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
./opencvexample/MotionSegmentation.o: In function `update_mhi':
/media/thanuja/DTR_DATA/ACTION-TV/ACTIONDETECTION/Implementations/ACTION_detection1/Debug/../opencvexample/MotionSegmentation.cpp:103: undefined reference to `cvUpdateMotionHistory'
/media/thanuja/DTR_DATA/ACTION-TV/ACTIONDETECTION/Implementations/ACTION_detection1/Debug/../opencvexample/MotionSegmentation.cpp:105: undefined reference to `cvUpdateMotionHistory'
/media/thanuja/DTR_DATA/ACTION-TV/ACTIONDETECTION/Implementations/ACTION_detection1/Debug/../opencvexample/MotionSegmentation.cpp:114: undefined reference to `cvCalcMotionGradient'
/media/thanuja/DTR_DATA/ACTION-TV/ACTIONDETECTION/Implementations/ACTION_detection1/Debug/../opencvexample/MotionSegmentation.cpp:123: undefined reference to `cvSegmentMotion'
/media/thanuja/DTR_DATA/ACTION-TV/ACTIONDETECTION/Implementations/ACTION_detection1/Debug/../opencvexample/MotionSegmentation.cpp:149: undefined reference to `cvCalcGlobalOrientation'
collect2: error: ld returned 1 exit status
make: *** [ACTION_detection1] Error 1

可以看到,我已经将所有opencv库链接到mu Eclipse项目。我还尝试了提供的命令行解决方案,但仍然得到相同的错误

它们已从主存储库替换为
opencv\u contrib
。您可以在模块中找到它们


注意:
cvUpdateMotionHistory
cvCalcMotionGradient
等是OpenCV 1.x API函数的名称,它们现在已经过时/过时,因此尝试通过替换为
cv::updateMotionHistory
cv::calcMotionGradient
等来避免它们。

很难说问题出在哪里。你所说的“认为opencv已经正确安装”是什么意思?您是如何安装的?如果术语令人困惑,很抱歉。我遵循opencv文档中的指导原则,使用简单的程序,如查看图像、播放视频和色彩增强等,效果很好。问题似乎出在这些运动分割函数上。windows环境中也出现了同样的错误。然而,添加链接器库opencv_视频解决了这些问题。即使添加了这个库,Ubuntu中的问题仍然存在。你知道怎么解决这个问题吗?谢谢。我相信是这样的。我尝试使用的是opencv的旧版本。