Ask Your Question
0

OpenCV 2.4.3 ffmpeg multiple definition [static build]

asked 2012-11-07 21:54:35 -0600

ponai gravatar image

updated 2012-11-08 04:25:30 -0600

Vladislav Vinogradov gravatar image

I'm building OpenCV 2.4.3 on ubuntu 12.04, it stops here.

Linking CXX executable ../../bin/opencv_perf_gpu
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::init()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG4initEv+0x0): multiple definition of `CvCapture_FFMPEG::init()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4initEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::close()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x0): multiple definition of `CvCapture_FFMPEG::close()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::open(char const*)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x0): multiple definition of `CvCapture_FFMPEG::open(char const*)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x0): multiple definition of `CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::r2d(AVRational)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG3r2dE10AVRational+0x0): multiple definition of `CvCapture_FFMPEG::r2d(AVRational)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG3r2dE10AVRational+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::get_duration_sec()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG16get_duration_secEv+0x0): multiple definition of `CvCapture_FFMPEG::get_duration_sec()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG16get_duration_secEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::get_bitrate()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG11get_bitrateEv+0x0): multiple definition of `CvCapture_FFMPEG::get_bitrate()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG11get_bitrateEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::get_fps()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG7get_fpsEv+0x0): multiple definition of `CvCapture_FFMPEG::get_fps()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG7get_fpsEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::get_total_frames()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG16get_total_framesEv+0x0): multiple definition of `CvCapture_FFMPEG::get_total_frames()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG16get_total_framesEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::getProperty(int)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG11getPropertyEi+0x0): multiple definition of `CvCapture_FFMPEG::getProperty(int)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG11getPropertyEi+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::dts_to_sec(long long)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG10dts_to_secEx+0x0): multiple definition of `CvCapture_FFMPEG::dts_to_sec(long long)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG10dts_to_secEx+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::dts_to_frame_number(long long)':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG19dts_to_frame_numberEx+0x0): multiple definition of `CvCapture_FFMPEG::dts_to_frame_number(long long)'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG19dts_to_frame_numberEx+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG::grabFrame()':
ffmpeg_video_source.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x0): multiple definition of `CvCapture_FFMPEG::grabFrame()'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o):cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x0): first defined here
../../lib/libopencv_gpu.a(ffmpeg_video_source.cpp.o): In function `CvCapture_FFMPEG ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-11-08 05:49:02 -0600

Vladislav Vinogradov gravatar image

This problem appears only if you build OpenCV as static library with CUDA and FFmpeg.

To fix the problem replace the following lines in opencv/modules/gpu/src/ffmpeg_video_source.cpp

#ifdef HAVE_FFMPEG
    #include "cap_ffmpeg_impl.hpp"
#else
    #include "cap_ffmpeg_api.hpp"
#endif

with

#if defined(HAVE_FFMPEG) && defined(BUILD_SHARED_LIBS)
    #include "cap_ffmpeg_impl.hpp"
#else
    #include "cap_ffmpeg_api.hpp"
#endif
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-07 21:54:35 -0600

Seen: 1,331 times

Last updated: Nov 08 '12