Ask Your Question
0

Static linking help needed when including the viz module (VTK)

asked 2018-02-04 23:44:09 -0600

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)" (?vtkRenderingOpenGL2_AutoInit_Construct@@YAXXZ) referenced in function "public: __thiscall vtkRenderingCore_AutoInit::vtkRenderingCore_AutoInit(void)" (??0vtkRenderingCore_AutoInit@@QAE@XZ)

opencv_viz340d.lib(opencv_viz_pch.obj) : error LNK2019: unresolved external symbol "void __cdecl vtkRenderingOpenGL2_AutoInit_Destruct(void)" (?vtkRenderingOpenGL2_AutoInit_Destruct@@YAXXZ) referenced in function "public: __thiscall vtkRenderingCore_AutoInit::~vtkRenderingCore_AutoInit(void)" (??1vtkRenderingCore_AutoInit@@QAE@XZ)

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)" (?PrintSelf@vtkOpenGLGL2PSHelper@@UAEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VvtkIndent@@@Z) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class vtkIndent)" (?PrintSelf@vtkOpenGLGL2PSHelperImpl@@UAEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VvtkIndent@@@Z)

vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "protected: __thiscall vtkOpenGLGL2PSHelper::vtkOpenGLGL2PSHelper(void)" (??0vtkOpenGLGL2PSHelper@@IAE@XZ) referenced in function "protected: __thiscall vtkOpenGLGL2PSHelperImpl::vtkOpenGLGL2PSHelperImpl(void)" (??0vtkOpenGLGL2PSHelperImpl@@IAE@XZ)

vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "protected: virtual __thiscall vtkOpenGLGL2PSHelper::~vtkOpenGLGL2PSHelper(void)" (??vtkOpenGLGL2PSHelper@@MAE@XZ) referenced in function "protected: virtual __thiscall vtkOpenGLGL2PSHelperImpl::~vtkOpenGLGL2PSHelperImpl(void)" (??1vtkOpenGLGL2PSHelperImpl@@MAE@XZ)

vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall vtkTransformFeedback::GetBytesPerVertex(void)const " (?GetBytesPerVertex@vtkTransformFeedback@@QBEIXZ) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(class vtkTransformFeedback *,class vtkRenderer *,float * const)" (?ProcessTransformFeedback@vtkOpenGLGL2PSHelperImpl@@UAEXPAVvtkTransformFeedback@@PAVvtkRenderer@@QAM@Z)

vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall vtkTransformFeedback::GetBufferSize(void)const " (?GetBufferSize@vtkTransformFeedback@@QBEIXZ) referenced in function "public: virtual void __thiscall vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(class vtkTransformFeedback *,class vtkRenderer *,float * const)" (?ProcessTransformFeedback@vtkOpenGLGL2PSHelperImpl@@UAEXPAVvtkTransformFeedback@@PAVvtkRenderer@@QAM@Z)

vtkRenderingGL2PSOpenGL2-8.1.lib(vtkOpenGLGL2PSHelperImpl.obj) : error LNK2019: unresolved external symbol __imp__glGetDoublev@8 referenced in function "protected: static void __cdecl vtkOpenGLGL2PSHelperImpl::GetTransformParameters(class vtkRenderer *,class vtkMatrix4x4 *,class vtkMatrix4x4 *,double * const,double * const,double * const)" (?GetTransformParameters@vtkOpenGLGL2PSHelperImpl@@KAXPAVvtkRenderer@@PAVvtkMatrix4x4@@1QAN22@Z)

    vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function _gl2psDrawImageMap

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function _gl2psDrawImageMap

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glFeedbackBuffer@12 referenced in function _gl2psBeginPage

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glGetBooleanv@8 referenced in function _gl2psDrawPixels

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glGetFloatv@8 referenced in function _gl2psBeginPage

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glGetIntegerv@8 referenced in function _gl2psBeginPage

vtkgl2ps-8.1.lib(gl2ps.obj) : error LNK2019: unresolved external symbol __imp__glIsEnabled@4 referenced in function ...
(more)
edit retag flag offensive close merge delete

Comments

"unresolved external symbol" -> means you have included some Headers & corresponding linking is failing. Try to include opengl32.lib, glu32.lib in your project settings.

Balaji R gravatar imageBalaji R ( 2018-02-05 02:43:49 -0600 )edit

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.

replaysMike gravatar imagereplaysMike ( 2018-02-05 16:25:34 -0600 )edit

These are OpenGL related libs that comes with your OS itself. You can find the path of those libs here

Balaji R gravatar imageBalaji R ( 2018-02-05 22:30:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-02-07 17:11:29 -0600

I was able to resolve my issue by using the shared libs (dlls) rather than linking statically. Currently there is an issue in the VTK 8.1 build from git that causes some grief. The official release build works, but I ended up just sticking with the dll's (link the dynamic lib files, add the includes) and make sure those dll's are available in the system PATH for runtime. After figuring all that out I was able to get OpenCV 3.4 work with the viz module.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-02-04 23:03:20 -0600

Seen: 918 times

Last updated: Feb 07 '18