# VTK static library throws LNK error in VS2019

**URL:** https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599
**Category:** Support
**Created:** [November 7, 2020, 8:12am UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599 "2020-11-07T08:12:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [November 7, 2020, 8:12am UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/1 "2020-11-07T08:12:41Z")

</div>

- OS : Windows 10
- VTK version : VTK 9.0.1
- Configuration : X64 Debug
- Platform: VS2019 (v142)

I built VTK static libs with cmake flag `BUILD_SHARED_LIBS = 0`  
When I use them in Visual Studio, I see lot of link error, i suspect them to be OpenGL link errors,

1. Should I link any other libs? Where do I find them?
2. I use the following VTK\_MODULE\_INIT, should I change them for Static libs?  
`VTK_MODULE_INIT( vtkInteractionStyle );`  
`VTK_MODULE_INIT( vtkRenderingOpenGL2 );`  
`VTK_MODULE_INIT( vtkRenderingVolumeOpenGL2 );`  
`VTK_MODULE_INIT( vtkRenderingFreeType );`

Thanks  
Vishnu C

```
1>------ Build started: Project: SIMAT, Configuration: Debug x64 ------
1>Build started 11/7/2020 1:29:43 PM.
1>Target InitializeBuildStatus:
1> Touching "x64\Debug\SIMAT.tlog\unsuccessfulbuild".
1>Target ClCompile:
1> All outputs are up-to-date.
1> SIMATView.cpp
1>Target ResourceCompile:
1> All outputs are up-to-date.
1>Target Link:
1> LINK : warning LNK4098: defaultlib 'mfc140d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1> LINK : warning LNK4098: defaultlib 'mfcs140d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1> LINK : warning LNK4217: symbol '??0vtkDebugLeaksManager@@QEAA@XZ (public: __cdecl vtkDebugLeaksManager::vtkDebugLeaksManager(void))' defined in 'vtkCommonCore-9.0d.lib(vtkDebugLeaksManager.obj)' is imported by 'SIMAT.obj' in function '"void__cdecl `dynamic initializer for 'vtkDebugLeaksManagerInstance''(void)" (??__EvtkDebugLeaksManagerInstance@@YAXXZ)'
1> LINK : warning LNK4286: symbol '??0vtkDebugLeaksManager@@QEAA@XZ (public: __cdecl vtkDebugLeaksManager::vtkDebugLeaksManager(void))' defined in 'vtkCommonCore-9.0d.lib(vtkDebugLeaksManager.obj)' is imported by 'SIMATView.obj'
1> LINK : warning LNK4217: symbol '??1vtkDebugLeaksManager@@QEAA@XZ (public: __cdecl vtkDebugLeaksManager::~vtkDebugLeaksManager(void))' defined in 'vtkCommonCore-9.0d.lib(vtkDebugLeaksManager.obj)' is imported by 'SIMAT.obj' in function '"void__cdecl `dynamic atexit destructor for 'vtkDebugLeaksManagerInstance''(void)" (??__FvtkDebugLeaksManagerInstance@@YAXXZ)'
1> LINK : warning LNK4286: symbol '??1vtkDebugLeaksManager@@QEAA@XZ (public: __cdecl vtkDebugLeaksManager::~vtkDebugLeaksManager(void))' defined in 'vtkCommonCore-9.0d.lib(vtkDebugLeaksManager.obj)' is imported by 'SIMATView.obj'
1> LINK : warning LNK4217: symbol '??0vtkObjectFactoryRegistryCleanup@@QEAA@XZ (public: __cdecl vtkObjectFactoryRegistryCleanup::vtkObjectFactoryRegistryCleanup(void))' defined in 'vtkCommonCore-9.0d.lib(vtkObjectFactory.obj)' is imported by 'SIMAT.obj' in function '"void__cdecl `dynamic initializer for 'vtkObjectFactoryRegistryCleanupInstance''(void)" (??__EvtkObjectFactoryRegistryCleanupInstance@@YAXXZ)'
1> LINK : warning LNK4286: symbol '??0vtkObjectFactoryRegistryCleanup@@QEAA@XZ (public: __cdecl vtkObjectFactoryRegistryCleanup::vtkObjectFactoryRegistryCleanup(void))' defined in 'vtkCommonCore-9.0d.lib(vtkObjectFactory.obj)' is imported by 'SIMATView.obj'
1> LINK : warning LNK4217: symbol '??1vtkObjectFactoryRegistryCleanup@@QEAA@XZ (public: __cdecl vtkObjectFactoryRegistryCleanup::~vtkObjectFactoryRegistryCleanup(void))' defined in 'vtkCommonCore-9.0d.lib(vtkObjectFactory.obj)' is imported by 'SIMAT.obj' in function '"void__cdecl `dynamic atexit destructor for 'vtkObjectFactoryRegistryCleanupInstance''(void)" (??__FvtkObjectFactoryRegistryCleanupInstance@@YAXXZ)'
1> LINK : warning LNK4286: symbol '??1vtkObjectFactoryRegistryCleanup@@QEAA@XZ (public: __cdecl vtkObjectFactoryRegistryCleanup::~vtkObjectFactoryRegistryCleanup(void))' defined in 'vtkCommonCore-9.0d.lib(vtkObjectFactory.obj)' is imported by 'SIMATView.obj'
1> LINK : warning LNK4217: symbol '??0vtkMFCWindow@@QEAA@PEAVCWnd@@@Z (public: __cdecl vtkMFCWindow::vtkMFCWindow(class CWnd *))' defined in 'vtkGUISupportMFC-9.0d.lib(vtkMFCWindow.obj)' is imported by 'SIMATView.obj' in function '"public: virtual void__cdecl CSIMATView::OnInitialUpdate(void)" (?OnInitialUpdate@CSIMATView@@UEAAXXZ)'
1> LINK : warning LNK4217: symbol '??1vtkMFCWindow@@UEAA@XZ (public: virtual __cdecl vtkMFCWindow::~vtkMFCWindow(void))' defined in 'vtkGUISupportMFC-9.0d.lib(vtkMFCWindow.obj)' is imported by 'SIMATView.obj' in function '"public: virtual void *__cdecl vtkMFCWindow::`scalar deleting destructor'(unsigned int)" (??_GvtkMFCWindow@@UEAAPEAXI@Z)'
1> LINK : warning LNK4217: symbol '?DrawDC@vtkMFCWindow@@QEAAXPEAVCDC@@@Z (public: void __cdecl vtkMFCWindow::DrawDC(class CDC *))' defined in 'vtkGUISupportMFC-9.0d.lib(vtkMFCWindow.obj)' is imported by 'SIMATView.obj' in function '"public: virtual void__cdecl CSIMATView::OnDraw(class CDC *)" (?OnDraw@CSIMATView@@UEAAXPEAVCDC@@@Z)'
1> LINK : warning LNK4217: symbol '?New@vtkActor@@SAPEAV1@XZ (public: static class vtkActor * __cdecl vtkActor::New(void))' defined in 'vtkRenderingCore-9.0d.lib(vtkActor.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)'
1> LINK : warning LNK4217: symbol '?New@vtkRenderer@@SAPEAV1@XZ (public: static class vtkRenderer * __cdecl vtkRenderer::New(void))' defined in 'vtkRenderingCore-9.0d.lib(vtkRenderer.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)'
1> LINK : warning LNK4217: symbol '?AddActor@vtkRenderer@@QEAAXPEAVvtkProp@@@Z (public: void __cdecl vtkRenderer::AddActor(class vtkProp *))' defined in 'vtkRenderingCore-9.0d.lib(vtkRenderer.obj)' is imported by 'SIMATView.obj' in function '"public: void__cdecl CSIMATView::loadSTL(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?loadSTL@CSIMATView@@QEAAXV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)'
1> LINK : warning LNK4217: symbol '??1vtkSmartPointerBase@@QEAA@XZ (public: __cdecl vtkSmartPointerBase::~vtkSmartPointerBase(void))' defined in 'vtkCommonCore-9.0d.lib(vtkSmartPointerBase.obj)' is imported by 'SIMATView.obj' in function '"public:__cdecl vtkSmartPointer<class vtkActor>::~vtkSmartPointer<class vtkActor>(void)" (??1?$vtkSmartPointer@VvtkActor@@@@QEAA@XZ)'
1> LINK : warning LNK4217: symbol '??0vtkSmartPointerBase@@IEAA@PEAVvtkObjectBase@@AEBVNoReference@0@@Z (protected: __cdecl vtkSmartPointerBase::vtkSmartPointerBase(class vtkObjectBase *,class vtkSmartPointerBase::NoReference const &))' defined in 'vtkCommonCore-9.0d.lib(vtkSmartPointerBase.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl vtkSmartPointer<class vtkActor>::vtkSmartPointer<class vtkActor>(class vtkActor *,class vtkSmartPointerBase::NoReference const &)" (??0?$vtkSmartPointer@VvtkActor@@@@IEAA@PEAVvtkActor@@AEBVNoReference@vtkSmartPointerBase@@@Z)'
1> LINK : warning LNK4217: symbol '?New@vtkRenderWindowInteractor@@SAPEAV1@XZ (public: static class vtkRenderWindowInteractor * __cdecl vtkRenderWindowInteractor::New(void))' defined in 'vtkRenderingCore-9.0d.lib(vtkRenderWindowInteractor.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)'
1> LINK : warning LNK4217: symbol '?SetRenderWindow@vtkRenderWindowInteractor@@QEAAXPEAVvtkRenderWindow@@@Z (public: void __cdecl vtkRenderWindowInteractor::SetRenderWindow(class vtkRenderWindow *))' defined in 'vtkRenderingCore-9.0d.lib(vtkRenderWindowInteractor.obj)' is imported by 'SIMATView.obj' in function '"public: virtual void__cdecl CSIMATView::OnInitialUpdate(void)" (?OnInitialUpdate@CSIMATView@@UEAAXXZ)'
1> LINK : warning LNK4217: symbol '?New@vtkInteractorStyleTrackballCamera@@SAPEAV1@XZ (public: static class vtkInteractorStyleTrackballCamera * __cdecl vtkInteractorStyleTrackballCamera::New(void))' defined in 'vtkInteractionStyle-9.0d.lib(vtkInteractorStyleTrackballCamera.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)'
1> LINK : warning LNK4217: symbol '?GetOutputPort@vtkAlgorithm@@QEAAPEAVvtkAlgorithmOutput@@XZ (public: class vtkAlgorithmOutput * __cdecl vtkAlgorithm::GetOutputPort(void))' defined in 'vtkRenderingCore-9.0d.lib(vtkInteractorStyle.obj)' is imported by 'SIMATView.obj' in function '"public: void__cdecl CSIMATView::loadSTL(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?loadSTL@CSIMATView@@QEAAXV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)'
1> LINK : warning LNK4217: symbol '?New@vtkPolyDataMapper@@SAPEAV1@XZ (public: static class vtkPolyDataMapper * __cdecl vtkPolyDataMapper::New(void))' defined in 'vtkRenderingCore-9.0d.lib(vtkPolyDataMapper.obj)' is imported by 'SIMATView.obj' in function '"protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)'
1> SIMATView.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkCapsuleSource *__cdecl vtkCapsuleSource::New(void)" (__imp_?New@vtkCapsuleSource@@SAPEAV1@XZ) referenced in function "protected:__cdecl CSIMATView::CSIMATView(void)" (??0CSIMATView@@IEAA@XZ)
1> Hint on symbols that are defined and could potentially match:
1> "__declspec(dllimport) public: static class vtkActor *__cdecl vtkActor::New(void)" (__imp_?New@vtkActor@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkInteractorStyleTrackballCamera *__cdecl vtkInteractorStyleTrackballCamera::New(void)" (__imp_?New@vtkInteractorStyleTrackballCamera@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkPolyDataMapper *__cdecl vtkPolyDataMapper::New(void)" (__imp_?New@vtkPolyDataMapper@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkRenderWindowInteractor *__cdecl vtkRenderWindowInteractor::New(void)" (__imp_?New@vtkRenderWindowInteractor@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkRenderer *__cdecl vtkRenderer::New(void)" (__imp_?New@vtkRenderer@@SAPEAV1@XZ)
1> SIMATView.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkSTLReader *__cdecl vtkSTLReader::New(void)" (__imp_?New@vtkSTLReader@@SAPEAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkSTLReader>__cdecl vtkSmartPointer<class vtkSTLReader>::New(void)" (?New@?$vtkSmartPointer@VvtkSTLReader@@@@SA?AV1@XZ)
1> Hint on symbols that are defined and could potentially match:
1> "__declspec(dllimport) public: static class vtkActor *__cdecl vtkActor::New(void)" (__imp_?New@vtkActor@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkInteractorStyleTrackballCamera *__cdecl vtkInteractorStyleTrackballCamera::New(void)" (__imp_?New@vtkInteractorStyleTrackballCamera@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkPolyDataMapper *__cdecl vtkPolyDataMapper::New(void)" (__imp_?New@vtkPolyDataMapper@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkRenderWindowInteractor *__cdecl vtkRenderWindowInteractor::New(void)" (__imp_?New@vtkRenderWindowInteractor@@SAPEAV1@XZ)
1> "__declspec(dllimport) public: static class vtkRenderer *__cdecl vtkRenderer::New(void)" (__imp_?New@vtkRenderer@@SAPEAV1@XZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglCreateContext referenced in function "public: virtual void__ cdecl vtkWin32OpenGLRenderWindow::SetupPixelFormatPaletteAndContext(struct HDC__*,unsigned long,int,int,int)" (?SetupPixelFormatPaletteAndContext@vtkWin32OpenGLRenderWindow@@UEAAXPEAUHDC__@@KHHH@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglDeleteContext referenced in function "public: void__ cdecl vtkWin32OpenGLRenderWindow::SetWindowId(struct HWND__*)" (?SetWindowId@vtkWin32OpenGLRenderWindow@@QEAAXPEAUHWND__@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglGetCurrentContext referenced in function "public: virtual bool__ cdecl vtkWin32OpenGLRenderWindow::InitializeFromCurrentContext(void)" (?InitializeFromCurrentContext@vtkWin32OpenGLRenderWindow@@UEAA_NXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglGetCurrentDC referenced in function "public: virtual bool__ cdecl vtkWin32OpenGLRenderWindow::InitializeFromCurrentContext(void)" (?InitializeFromCurrentContext@vtkWin32OpenGLRenderWindow@@UEAA_NXZ)
1> vtkglew-9.0d.lib(glew.obj) : error LNK2001: unresolved external symbol __imp_wglGetCurrentDC
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglGetProcAddress referenced in function "public: virtual void__ cdecl vtkWin32OpenGLRenderWindow::SetupPixelFormatPaletteAndContext(struct HDC__*,unsigned long,int,int,int)" (?SetupPixelFormatPaletteAndContext@vtkWin32OpenGLRenderWindow@@UEAAXPEAUHDC__@@KHHH@Z)
1> vtkglew-9.0d.lib(glew.obj) : error LNK2001: unresolved external symbol __imp_wglGetProcAddress
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglMakeCurrent referenced in function "public: virtual void__ cdecl vtkWin32OpenGLRenderWindow::MakeCurrent(void)" (?MakeCurrent@vtkWin32OpenGLRenderWindow@@UEAAXXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_wglShareLists referenced in function "public: virtual void__ cdecl vtkWin32OpenGLRenderWindow::Initialize(void)" (?Initialize@vtkWin32OpenGLRenderWindow@@UEAAXXZ)
1> vtkglew-9.0d.lib(glew.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLShaderCache.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureUnitManager.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLGPUVolumeRayCastMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLProjectedTetrahedraMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLState.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLFramebufferObject.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLGlyph3DMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper2D.obj) : error LNK2001: unresolved external symbol __imp_glGetIntegerv
1> vtkglew-9.0d.lib(glew.obj) : error LNK2001: unresolved external symbol __imp_glGetString
1> vtkRenderingOpenGL2-9.0d.lib(vtkWin32OpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glGetString
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderer.obj) : error LNK2001: unresolved external symbol __imp_glGetString
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glGetString
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLState.obj) : error LNK2001: unresolved external symbol __imp_glGetString
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLProjectedTetrahedraMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLRayCastImageDisplayHelper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkShadowMapBakerPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkRenderbuffer.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkCameraPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLGPUVolumeRayCastMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkShadowMapPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLFramebufferObject.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkTransformFeedback.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkPixelBufferObject.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkDepthPeelingPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkHiddenLineRemovalPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLFXAAFilter.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOrderIndependentTranslucentPass.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLState.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLGlyph3DHelper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLProperty.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderer.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLSkybox.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLTexture.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLImageSliceMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLGlyph3DMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper2D.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLActor.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLCamera.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLLabeledContourMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLImageMapper.obj) : error LNK2001: unresolved external symbol __imp_glGetError
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLLabeledContourMapper.obj) : error LNK2019: unresolved external symbol __imp_glClearStencil referenced in function "protected: virtual bool__ cdecl vtkOpenGLLabeledContourMapper::ApplyStencil(class vtkRenderer *,class vtkActor *)" (?ApplyStencil@vtkOpenGLLabeledContourMapper@@MEAA_NPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLLabeledContourMapper.obj) : error LNK2019: unresolved external symbol __imp_glStencilFunc referenced in function "protected: virtual bool__ cdecl vtkOpenGLLabeledContourMapper::ApplyStencil(class vtkRenderer *,class vtkActor *)" (?ApplyStencil@vtkOpenGLLabeledContourMapper@@MEAA_NPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLLabeledContourMapper.obj) : error LNK2019: unresolved external symbol __imp_glStencilMask referenced in function "protected: virtual bool__ cdecl vtkOpenGLLabeledContourMapper::ApplyStencil(class vtkRenderer *,class vtkActor *)" (?ApplyStencil@vtkOpenGLLabeledContourMapper@@MEAA_NPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLLabeledContourMapper.obj) : error LNK2019: unresolved external symbol __imp_glStencilOp referenced in function "protected: virtual bool__ cdecl vtkOpenGLLabeledContourMapper::ApplyStencil(class vtkRenderer *,class vtkActor *)" (?ApplyStencil@vtkOpenGLLabeledContourMapper@@MEAA_NPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkVolumeTexture.obj) : error LNK2019: unresolved external symbol __imp_glPixelStorei referenced in function "protected:__ cdecl vtkVolumeTexture::vtkVolumeTexture(void)" (??0vtkVolumeTexture@@IEAA@XZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLImageMapper.obj) : error LNK2001: unresolved external symbol __imp_glPixelStorei
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2001: unresolved external symbol __imp_glPixelStorei
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2001: unresolved external symbol __imp_glPixelStorei
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLFramebufferObject.obj) : error LNK2001: unresolved external symbol __imp_glPixelStorei
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPointGaussianMapper.obj) : error LNK2019: unresolved external symbol __imp_glDrawArrays referenced in function "protected: virtual void__ cdecl vtkOpenGLPointGaussianMapperHelper::RenderPieceDraw(class vtkRenderer *,class vtkActor *)" (?RenderPieceDraw@vtkOpenGLPointGaussianMapperHelper@@MEAAXPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderUtilities.obj) : error LNK2001: unresolved external symbol __imp_glDrawArrays
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLInstanceCulling.obj) : error LNK2001: unresolved external symbol __imp_glDrawArrays
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLQuadHelper.obj) : error LNK2001: unresolved external symbol __imp_glDrawArrays
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPointGaussianMapper.obj) : error LNK2019: unresolved external symbol __imp_glPointSize referenced in function "protected: void__ cdecl vtkOpenGLPointGaussianMapper::RenderInternal(class vtkRenderer *,class vtkActor *)" (?RenderInternal@vtkOpenGLPointGaussianMapper@@IEAAXPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper.obj) : error LNK2001: unresolved external symbol __imp_glPointSize
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper2D.obj) : error LNK2001: unresolved external symbol __imp_glPointSize
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLGlyph3DHelper.obj) : error LNK2001: unresolved external symbol __imp_glPointSize
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper.obj) : error LNK2019: unresolved external symbol __imp_glLineWidth referenced in function "public: virtual void__ cdecl vtkOpenGLPolyDataMapper::RenderPieceDraw(class vtkRenderer *,class vtkActor *)" (?RenderPieceDraw@vtkOpenGLPolyDataMapper@@UEAAXPEAVvtkRenderer@@PEAVvtkActor@@@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLPolyDataMapper2D.obj) : error LNK2001: unresolved external symbol __imp_glLineWidth
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_glEnable referenced in function "public: virtual void__ cdecl vtkOpenGLRenderWindow::OpenGLInitState(void)" (?OpenGLInitState@vtkOpenGLRenderWindow@@UEAAXXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLState.obj) : error LNK2001: unresolved external symbol __imp_glEnable
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_glFinish referenced in function "public: virtual void__ cdecl vtkOpenGLRenderWindow::WaitForCompletion(void)" (?WaitForCompletion@vtkOpenGLRenderWindow@@UEAAXXZ)
1> vtkRenderingVolumeOpenGL2-9.0d.lib(vtkOpenGLGPUVolumeRayCastMapper.obj) : error LNK2001: unresolved external symbol __imp_glFinish
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_glFlush referenced in function "public: virtual int__ cdecl vtkOpenGLRenderWindow::SetPixelData(int,int,int,int,unsigned char *,int,int)" (?SetPixelData@vtkOpenGLRenderWindow@@UEAAHHHHHPEAEHH@Z)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_glGetFloatv referenced in function "public: virtual void__ cdecl vtkOpenGLRenderWindow::OpenGLInitContext(void)" (?OpenGLInitContext@vtkOpenGLRenderWindow@@UEAAXXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLState.obj) : error LNK2001: unresolved external symbol __imp_glGetFloatv
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2001: unresolved external symbol __imp_glGetFloatv
1> vtkRenderingOpenGL2-9.0d.lib(vtkDualDepthPeelingPass.obj) : error LNK2001: unresolved external symbol __imp_glGetFloatv
1> vtkRenderingOpenGL2-9.0d.lib(vtkOpenGLRenderWindow.obj) : error LNK2019: unresolved external symbol __imp_glReadPixels referenced in function "public: virtual int__ cdecl vtkOpenGLRenderWindow::GetZbufferData(int,int,int,int,float *)" vtkTextureObject::SendParameters(void)" (?SendParameters@vtkTextureObject@@QEAAXXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2019: unresolved external symbol __imp_glTexParameterfv referenced in function "public: void__ cdecl vtkTextureObject::SendParameters(void)" (?SendParameters@vtkTextureObject@@QEAAXXZ)
1> vtkRenderingOpenGL2-9.0d.lib(vtkTextureObject.obj) : error LNK2019: unresolved external symbol __imp_glTexParameteri referenced in function "public: void__ cdecl vtkTextureObject::SendParameters(void)" (?SendParameters@vtkTextureObject@@QEAAXXZ)
1> vtksys-9.0d.lib(SystemInformation.obj) : error LNK2019: unresolved external symbol GetProcessMemoryInfo referenced in function "public: __int64__ cdecl vtksys::SystemInformationImplementation::GetProcMemoryUsed(void)" (?GetProcMemoryUsed@SystemInformationImplementation@vtksys@@QEAA_JXZ)
1> vtksys-9.0d.lib(SystemInformation.obj) : error LNK2019: unresolved external symbol __imp_SymGetLineFromAddr64 referenced in function "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >__ cdecl vtksys::SystemInformationImplementation::GetProgramStack(int,int)" (?GetProgramStack@SystemInformationImplementation@vtksys@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z)
1> vtksys-9.0d.lib(SystemInformation.obj) : error LNK2019: unresolved external symbol __imp_SymInitialize referenced in function "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >__ cdecl vtksys::SystemInformationImplementation::GetProgramStack(int,int)" (?GetProgramStack@SystemInformationImplementation@vtksys@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z)
1> vtksys-9.0d.lib(SystemInformation.obj) : error LNK2019: unresolved external symbol __imp_SymFromAddr referenced in function "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >__ cdecl vtksys::SystemInformationImplementation::GetProgramStack(int,int)" (?GetProgramStack@SystemInformationImplementation@vtksys@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z)
1> D:\projects\current\SIMAT\src\3rdParty\gult\glut.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
1> D:\projects\current\SIMAT\src\3rdParty\gult\glut32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
1> D:\projects\current\SIMAT\src\simat\x64\Debug\SIMAT.exe : fatal error LNK1120: 55 unresolved externals
1>Done building target "Link" in project "SIMAT.vcxproj" -- FAILED.
```

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 7, 2020, 12:13pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/2 "2020-11-07T12:13:30Z")

</div>

Although there are lots of errors related to `unresolved external symbol __imp_glGetError` …

Resolve this first.

```auto
1> D:\projects\current\SIMAT\src\3rdParty\gult\glut.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
1> D:\projects\current\SIMAT\src\3rdParty\gult\glut32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'

```

Your build configuration is `x64`, printed in the very first line of the log, while `glut.lib`, `glut32.lib` were built to target `x86` platforms. Be consistent here.

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [November 7, 2020, 12:42pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/3 "2020-11-07T12:42:48Z")

</div>

Thanks,  
I resolved by removing them from additional dependencies.  
I just see ` __imp_wgl*` and `__ imp_gl*` errors.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 7, 2020, 12:52pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/4 "2020-11-07T12:52:48Z")

</div>

You might have to link to opengl32.lib on windows. It doesn’t look like you use CMake for your project.  
I cannot suggest anything else other than this.

In VS2019, check out your solution properties, add opengl32.lib to linker’s additional dependencies. That should pull in the wgl/gl function pointers.

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [November 7, 2020, 1:13pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/5 "2020-11-07T13:13:55Z")

</div>

I did use CMake for build VTK libs.

Where do I find this opengl32.lib? I see lots of suggestion to add this, but I cannot find it in my computer or in web.

Thanks

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 7, 2020, 1:39pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/6 "2020-11-07T13:39:15Z")

</div>

What matters is that you are not using CMake to build your current project. (Not VTK).

If you used CMake, then you’d have to add `find_package(OpenGL REQUIRED)` and link to `OpenGL::GL`.

But you do not have to do that since you’re using VS2019 default build methods. You are not required to find `opengl32.lib` anywhere. Just add it to the list of dependencies like this example

 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/3fbd03246b828813827d769072c3217bae29fa43.png)

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [November 7, 2020, 3:20pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/7 "2020-11-07T15:20:41Z")

</div>

Ok,  
I did these, I build a example VTK project from cmake and used all the additions libs created there in my application. Now I can run my application good. Thanks for your support.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 7, 2020, 3:21pm UTC](https://discourse.vtk.org/t/vtk-static-library-throws-lnk-error-in-vs2019/4599/8 "2020-11-07T15:21:46Z")

</div>

Cheers!
