opencv在linux上的eclipse中构建错误

时间:2015-02-03 18:25:37

标签: c++ linux eclipse opencv

嗨伙计们。我正在尝试使用opencv库编译C ++代码,但我正面临挑战。所有的图像处理,即imread,imshow和它们都工作正常但是当我尝试使用VideoCapture加载视频文件时,我的c ++代码并没有在linux环境中的eclipse luna中构建。我添加了一个小代码片段,仅用于使用VideoCapture测试视频支持,但它无法正常工作。有人可以帮我解决这个问题。这是eclipse控制台和小型c ++代码片段的输出。

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

using namespace cv;
using namespace std;

int main(){
    VideoCapture capture("traffic.mp4");
}
20:14:05 **** Incremental Build of configuration Release for project RealTimeObjectTracking ****
make all 
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: RealTimeObjectTracking
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "RealTimeObjectTracking"  ./main.o   -lopencv_core -lopencv_ml -lopencv_video -lopencv_features2d  -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_highgui
/usr/bin/ld: warning: libavcodec.so.54, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
makefile:44: recipe for target 'RealTimeObjectTracking' failed
/usr/bin/ld: warning: libavformat.so.54, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavutil.so.52, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libswscale.so.2, needed by /usr/local/lib/libopencv_videoio.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_getContext@LIBSWSCALE_2'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_sub_q@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_opt_set@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_alloc_context@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_free@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avio_close@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_seek_frame@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_codec_get_id@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_alloc_frame@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_read_frame@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_free_context@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_getCachedContext@LIBSWSCALE_2'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_write_header@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_guess_format@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_encode_video@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_register_all@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_write_frame@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_free_packet@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_new_stream@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_rescale_q@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avpicture_get_size@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_find_encoder@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_freep@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_get_context_defaults3@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avio_open@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avpicture_fill@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_lockmgr_register@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_init_packet@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_open_input@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_scale@LIBSWSCALE_2'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_network_init@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_find_decoder@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avformat_close_input@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_decode_video2@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_write_trailer@LIBAVFORMAT_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_log_set_level@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `sws_freeContext@LIBSWSCALE_2'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_open2@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_malloc@LIBAVUTIL_52'
/usr/local/lib/libopencv_videoio.so: undefined reference to `avcodec_close@LIBAVCODEC_54'
/usr/local/lib/libopencv_videoio.so: undefined reference to `av_guess_codec@LIBAVFORMAT_54'
collect2: error: ld returned 1 exit status
make: *** [RealTimeObjectTracking] Error 1

0 个答案:

没有答案