赞
踩
在Ubuntu16.04上安装opencv4的时候,cmake的时候报了很多undefined reference
,错误信息如下:
//usr/lib/x86_64-linux-gnu/libgtk-3.so.0: undefined symbol: g_list_model_get_type
//usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to g_option_group_unref’
//usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to g_thread_pool_move_to_front’
//usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_sequence_is_empty’
collect2: error: ld returned 1 exit status
apps/visualisation/CMakeFiles/opencv_visualisation.dir/build.make:108: recipe for target ‘bin/opencv_visualisation’ failed
make[2]: *** [bin/opencv_visualisation] Error 1
CMakeFiles/Makefile2:7756: recipe for target ‘apps/visualisation/CMakeFiles/opencv_visualisation.dir/all’ failed
make[1]: *** [apps/visualisation/CMakeFiles/opencv_visualisation.dir/all] Error 2
/usr/lib/x86_64-linux-gnu/
目录下查看是否安装相应的依赖,如果没安装通过下面的命令进行安装sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev
cmake -DCMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -DBUILD_EXAMPLES=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
sudo make install
pkg-config --cflags opencv4
#安装成功会输出
-I/usr/local/include/opencv4
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。