我进入了通过CMake(配置和生成)成功填充构建文件的阶段。
一旦我通过终端在构建目录中运行make
,我会得到48%的致命错误以及之前的其他错误。
[ 47%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
[ 47%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o
[ 48%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_qtkit.mm.o
/Users/casparwylie/Desktop/Stuff/Programming/opencv/modules/videoio/src/cap_qtkit.mm:297:14: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
[NSTimer scheduledTimerWithTimeInterval:100 target:nil selector:@selector(doFireTimer:) userInfo:nil repeats:YES];
^ ~~~
1 warning generated.
[ 48%] Linking CXX shared library ../../lib/libopencv_videoio.dylib
Undefined symbols for architecture x86_64:
"_CMBlockBufferCreateWithMemoryBlock", referenced from:
_videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
"_CMSampleBufferCreate", referenced from:
_videotoolbox_common_end_frame in libavcodec.a(videotoolbox.o)
"_CMVideoFormatDescriptionCreate", referenced from:
_av_videotoolbox_default_init2 in libavcodec.a(videotoolbox.o)
"_ModPlug_GetCurrentOrder", referenced from:
此错误意味着什么,是否有任何修复或解决方法?
答案 0 :(得分:2)
我有完全相同的问题。在我的情况下,它是由于缺少ffmpeg引起的。您可以通过
安装ffmpegbrew install ffmpeg
通常,'arcgitecture的未定义符号......'与缺少的库有关。
答案 1 :(得分:1)
我有同样的问题编译kxmovie,结果我需要添加对coremedia框架和videotoolbox框架的引用,之后,链接很好
答案 2 :(得分:0)
在构建阶段链接 coremedia , videotoolbox 框架
答案 3 :(得分:0)
在构建阶段链接CoreMedia,VideoToolBox,安全框架。
或者您可以修改以下代码并将其添加到opencv-x.x.x / modules / highgui / CMakeLists.txt文件中:
find_library(CORE_MEDIA CoreMedia)
if (NOT CORE_MEDIA)
message(FATAL_ERROR "CoreMedia not found")
endif()
find_library(VIDEO_TOOL_BOX VideoToolBox)
if (NOT VIDEO_TOOL_BOX)
message(FATAL_ERROR "VideoToolBox not found")
endif()
find_library(SECURITY Security)
if (NOT SECURITY)
message(FATAL_ERROR "Security not found")
endif()
target_link_libraries(${the_module} ${CORE_MEDIA} ${VIDEO_TOOL_BOX} ${SECURITY})
关键是使用find_library& opencv_highgui模块的CMakeLists.txt文件中的target_link_libraries。