opencv无法用vtk_on制作

时间:2017-08-10 14:24:24

标签: opencv ubuntu vtk

即时通讯使用ubuntu 14.04。我已经成功安装了vtk8.0.0。

现在我想用vtk on构建opencv2.4.13.2。

总有错误,见下文。

In file included from /usr/local/include/vtk-8.0/vtkGenericDataArray.h:72:0,
                 from /usr/local/include/vtk-8.0/vtkAOSDataArrayTemplate.h:35,
                 from /usr/local/include/vtk-8.0/vtkIntArray.h:33,
                 from /usr/local/include/vtk-8.0/vtkCellTypes.h:42,
                 from /usr/local/include/vtk-8.0/vtkPolyData.h:64,
                 from /usr/local/include/vtk-8.0/vtkPolyDataAlgorithm.h:36,
                 from /usr/local/include/vtk-8.0/vtkAppendPolyData.h:35,
                 from /home/suyz/Install/opencv/opencv-2.4.13.2/modules/viz/src/precomp.hpp:56,
                 from /home/suyz/Install/opencv/release/modules/viz/opencv_viz_pch_dephelp.cxx:1:
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h:72:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
     : AssociatedArray{nullptr}, SortedArray(nullptr),
     ^
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h: In constructor ‘vtkGenericDataArrayLookupHelper<ArrayTypeT>::vtkGenericDataArrayLookupHelper()’:
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h:72:7: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
     : AssociatedArray{nullptr}, SortedArray(nullptr),
       ^
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h:72:23: error: ‘nullptr’ was not declared in this scope
     : AssociatedArray{nullptr}, SortedArray(nullptr),
                       ^
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h:73:5: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
     FirstValue{nullptr}, SortedArraySize{0}
     ^
/usr/local/include/vtk-8.0/vtkGenericDataArrayLookupHelper.h:73:26: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
     FirstValue{nullptr}, SortedArraySize{0}
                          ^
make[2]: *** [modules/viz/CMakeFiles/opencv_viz_pch_dephelp.dir/opencv_viz_pch_dephelp.cxx.o] Error 1
make[1]: *** [modules/viz/CMakeFiles/opencv_viz_pch_dephelp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
有人有个主意,怎么解决这个问题?非常感谢!

1 个答案:

答案 0 :(得分:0)

VTK 8.0及更高版本需要c ++ 11编译器(nullptr是C ++ 11特性)。你安装了预建的VTK吗?如果是,请检查您使用的是gcc 4.8或更高版本,并确保您的c ++标志包含-std=c++11(您可以尝试将其添加到OpenCV版本中CMAKE_CXX_FLAGS的{​​{1}}条目中以查看如果错误消失了。