Repository: opencv
Issue: viz3d.cpp compiler error with vtk in build
Labels: bug,priority: normal,category: build/install,affected: 3.4,category: viz

It appears functions are being defined in the [viz3d.cpp](https://github.com/Itseez/opencv/blob/master/modules/viz/src/viz3d.cpp) file which aren't defined in any corresponding class definition or header. There are also a few undeclared identifiers, probably enums, in [types.cpp](https://github.com/Itseez/opencv/blob/master/modules/viz/src/types.cpp).

I have  b5d6d7016c66c0701c6de30f01e3be480e5a907f checked out for opencv and ac1e608b8245a8d93b8be904d7f27a5bd0019106 form opencv_contrib. (current master for both at ~8:30pm today)

The problems look like they are most likely due to https://github.com/Itseez/opencv/commit/079ceea6168d80f3c4bfc1d4d0a1581beefa7720

To setup I ran the following on OS X 10.10 with dependencies generally supplied by homebrew:

```
mkdir Itseez
cd Itseez
git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git
mkdir xcodebuild
cd xcodebuild
cmake ../opencv -G Xcode -DOPENCV_EXTRA_MODULES_PATH=/Users/athundt/source/git/Itseez/opencv_contrib/modules -DCMAKE_BUILD_TYPE=Debug
xcodebuild install
```

The above produced the following compiler errors:

```
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp:103:22: Out-of-line definition of 'setOffScreenRendering' does not match any declaration in 'cv::viz::Viz3d'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp:104:22: Out-of-line definition of 'removeAllLights' does not match any declaration in 'cv::viz::Viz3d'; did you mean 'removeAllWidgets'?
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp:105:22: Out-of-line definition of 'addLight' does not match any declaration in 'cv::viz::Viz3d'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp:119:22: Redefinition of 'removeAllWidgets'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/viz3d.cpp:141:25: Out-of-line definition of 'getScreenshot' does not match any declaration in 'cv::viz::Viz3d'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/types.cpp
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/types.cpp:60:30: Out-of-line definition of 'load' does not match any declaration in 'cv::viz::Mesh'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/types.cpp:64:12: Use of undeclared identifier 'LOAD_AUTO'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/types.cpp:69:12: Use of undeclared identifier 'LOAD_PLY'
/Users/athundt/source/git/Itseez/opencv/modules/viz/src/types.cpp:77:12: Use of undeclared identifier 'LOAD_OBJ'
```

Here is the cmake config output:

```
○ cmake ../opencv -G Xcode -DOPENCV_EXTRA_MODULES_PATH=/Users/athundt/source/git/Itseez/opencv_contrib/modules -DCMAKE_BUILD_TYPE=Debug
-- Checking for module 'libv4l1'
--   Package 'libv4l1' not found
-- Checking for module 'libv4l2'
--   Package 'libv4l2' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - not found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   Package 'libgphoto2' not found
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /Users/athundt/source/git/Itseez/opencv/3rdparty/ippicv/unpack/ippicv_osx
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.4" (found /usr/local/bin/python)
-- Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.2" (found /usr/local/bin/python)
-- Found apache ant 1.9.6: /usr/local/bin/ant
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
-- Found VTK ver. 6.3.0 (usefile: /usr/local/Cellar/vtk/6.3.0/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   YES
-- Tesseract:   NO
-- Assume that non-module dependency is available: -framework OpenCL (for module opencv_core)
-- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED
-- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED - Failed
-- Performing Test HAVE_CXX_WNO_SIGN_PROMO
-- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found PROTOBUF: /usr/local/lib/libprotobuf.dylib
-- The protocol buffer compiler and libprotobuf were found
-- Tesseract:   NO
--
-- General configuration for OpenCV 3.0.0-dev =====================================
--   Version control:               3.0.0-805-gb5d6d70
--
--   Platform:
--     Host:                        Darwin 14.5.0 x86_64
--     CMake:                       3.4.1
--     CMake generator:             Xcode
--     CMake build tool:            /usr/bin/xcodebuild
--     Xcode:                       7.1.1
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  (ver 7.0.0.7000176)
--     C++ flags (Release):         -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
--     C flags (Release):           -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     Precompiled headers:         NO
--     Extra dependencies:          -framework OpenCL /usr/local/lib/libwebp.dylib gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 intl dc1394 avcodec avformat avutil swscale avresample /usr/lib/libbz2.dylib -framework VideoDecodeAcceleration bz2 -framework QTKit -framework QuartzCore -framework AppKit -framework Cocoa $<$<NOT:$<CONFIG:DEBUG>>:/usr/local/lib/libprotobuf.dylib> $<$<CONFIG:DEBUG>:/usr/local/lib/libprotobuf.dylib> vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore /usr/lib/libz.dylib vtkmetaio /usr/local/lib/libjpeg.dylib /usr/local/lib/libpng.dylib /usr/local/lib/libtiff.dylib vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry vtkFiltersTexture vtkRenderingFreeType vtkfreetype vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL vtkgl2ps vtkRenderingLabel
--     3rdparty dependencies:       libjpeg libpng libtiff libjasper IlmImf zlib ippicv
--
--   OpenCV modules:
--     To be built:                 hal core flann imgproc ml photo reg surface_matching video viz dnn imgcodecs shape videoio highgui objdetect superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets java rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python2
--     Disabled:                    world contrib_world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python3 cvv matlab
--
--   GUI:
--     QT:                          NO
--     Cocoa:                       YES
--     OpenGL support:              NO
--     VTK support:                 YES (ver 6.3.0)
--
--   Media I/O:
--     ZLib:                        build (ver 1.2.8)
--     JPEG:                        build (ver 90)
--     WEBP:                        /usr/local/lib/libwebp.dylib (ver encoder: 0x0202)
--     PNG:                         build (ver 1.5.12)
--     TIFF:                        build (ver 42 - 4.0.2)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     GDAL:                        NO
--
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.2)
--     FFMPEG:                      YES
--       codec:                     YES (ver 56.60.100)
--       format:                    YES (ver 56.40.101)
--       util:                      YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       resample:                  YES (ver 2.1.0)
--       gentoo-style:              YES
--     GStreamer:
--       base:                      YES (ver 1.6.1)
--       video:                     YES (ver 1.6.1)
--       app:                       YES (ver 1.6.1)
--       riff:                      YES (ver 1.6.1)
--       pbutils:                   YES (ver 1.6.1)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     QuickTime:                   NO
--     QTKit:                       YES
--     V4L/V4L2:                    NO/NO
--     XIMEA:                       NO
--     gPhoto2:                     NO
--
--   Parallel framework:            GCD
--
--   Other third-party libraries:
--     Use IPP:                     9.0.1 [9.0.1]
--          at:                     /Users/athundt/source/git/Itseez/opencv/3rdparty/ippicv/unpack/ippicv_osx
--     Use IPP Async:               NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Eigen:                   YES (ver 3.2.6)
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
--
--   OpenCL:
--     Version:                     static
--     libraries:                   -framework OpenCL
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
--
--   Python 2:
--     Interpreter:                 /usr/local/bin/python2.7 (ver 2.7.10)
--     Libraries:                   /usr/lib/libpython2.7.dylib (ver 2.7.10)
--     numpy:                       /usr/local/lib/python2.7/site-packages/numpy/core/include (ver 1.10.1)
--     packages path:               lib/python2.7/site-packages
--
--   Python 3:
--     Interpreter:                 NO
--
--   Python (for build):            /usr/local/bin/python2.7
--
--   Java:
--     ant:                         /usr/local/bin/ant (ver 1.9.6)
--     JNI:                         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/JavaVM.framework/Headers
--     Java wrappers:               YES
--     Java tests:                  YES
--
--   Matlab:
--     mex:                         NO
--
--   Documentation:
--     Doxygen:                     /usr/local/bin/doxygen (ver 1.8.10)
--     PlantUML:                    NO
--
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              NO
--
--   Install path:                  /usr/local
--
--   cvconfig.h is in:              /Users/athundt/source/git/Itseez/xcodebuild
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/athundt/source/git/Itseez/xcodebuild
```