我用Pacman命令安装了OpenCV。但是我收到了数百行链接错误。我用命令编译了程序
gcc example.cpp -o example `pkg-config --cflags --libs opencv4`
和链接错误的一小部分如下。
usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkRenderingFreeType_AutoInit_Destruct()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkInteractorStyle::StartTwoPointer()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkInteractorStyle::EndZoom()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkSmartPointerBase::operator=(vtkObjectBase*)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkOStrStreamWrapper::freeze(int)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkCamera::SetUserTransform(vtkHomogeneousTransform*)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkCommand::UnRegister()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkRenderer::New()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkInteractorStyle::StartDolly()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkRenderer::SetActiveCamera(vtkCamera*)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkInteractorObserver::ReleaseFocus()'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkInteractorObserver::ComputeDisplayToWorld(double, double, double, double*)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkAlgorithm::Update(vtkInformation*)'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libopencv_viz.so: undefined reference to `vtkMatrix4x4::New()'
答案 0 :(得分:0)
opencv库本身已经存在,但是libopencv_viz.so
需要来自vtk库的一些符号,该库在opencv的PKGBUILD
中被列为optional dependency。
如果您认为应将依赖项设为非可选,则应该自己安装(例如pacman -S [--asdeps] vtk
),或向PKGBUILD
维护者投诉。