Static linking help needed when including the viz module (VTK)
Hey all!
I'm having an issue I've been fighting with all weekend. I'm trying to build a fairly simple example which uses the viz module in C++. I've built OpenCV 3.4 and OpenCV-contrib along with VTK 8.1.0 as static libs and all seems to be well there. But after adding all the libs and appropriate includes I get 19 build errors I can't seem to resolve and they all seem to be related to the opengl libraries within vtk.
opencv_viz340d.lib(opencv_viz_pch.obj) : error LNK2019: unresolved external symbol "void __cdecl vtkRenderingOpenGL2_AutoInit_Construct(void)" ([email protected]@YAXXZ) referenced in function "public: __thiscall vtkRenderingCore_AutoInit::vtkRenderingCore_AutoInit(void)" ([email protected]@[email protected])
opencv_viz340d.lib(opencv_viz_pch.obj) : error LNK2019: unresolved external symbol "void __cdecl vtkRenderingOpenGL2_AutoInit_Destruct(void)" ([email protected]@YAXXZ) referenced in function "public: __thiscall vtkRenderingCore_AutoInit::~vtkRenderingCore_AutoInit(void)" ([email protected]@[email protected])
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "public: virtual void __thiscall vtkOpenGLGL2PSHelper::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class vtkIndent)" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]@[email protected]@@Z) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class vtkIndent)" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]@[email protected]@@Z)
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "protected: __thiscall vtkOpenGLGL2PSHelper::vtkOpenGLGL2PSHelper(void)" ([email protected]@[email protected]) referenced in function "protected: __thiscall vtkOpenGLGL2PSHelperImpl::vtkOpenGLGL2PSHelperImpl(void)" ([email protected]@[email protected])
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "protected: virtual __thiscall vtkOpenGLGL2PSHelper::~vtkOpenGLGL2PSHelper(void)" ([email protected]@[email protected]) referenced in function "protected: virtual __thiscall vtkOpenGLGL2PSHelperImpl::~vtkOpenGLGL2PSHelperImpl(void)" ([email protected]@[email protected])
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall vtkTransformFeedback::GetBytesPerVertex(void)const " ([email protected]@@QBEIXZ) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(class vtkTransformFeedback *,class vtkRenderer *,float * const)" ([email protected]@@[email protected]@PAVvtk[email protected]@[email protected])
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall vtkTransformFeedback::GetBufferSize(void)const " ([email protected]@@QBEIXZ) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(class vtkTransformFeedback *,class vtkRenderer *,float * const)" ([email protected]@@[email protected]@[email protected]@[email protected])
vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function "protected: static void __cdecl vtkOpenGLGL2PSHelperImpl::GetTransformParameters(class vtkRenderer *,class vtkMatrix4x4 *,class vtkMatrix4x4 *,double * const,double * const,double * const)" ([email protected]@@[email protected]@[email protected]@[email protected])
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psDrawImageMap
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psDrawImageMap
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psBeginPage
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psDrawPixels
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psBeginPage
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _gl2psBeginPage
vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function ...
"unresolved external symbol" -> means you have included some Headers & corresponding linking is failing. Try to include opengl32.lib, glu32.lib in your project settings.
thanks that part I understood lol ;) Does glew need to be built along with VTK? I didn't see those lib files generated anywhere, I had thought VTK shipped with opengl libs built in.
These are OpenGL related libs that comes with your OS itself. You can find the path of those libs here