VTK-从6.1迁移到8.2 [2]

时间:2019-03-21 14:44:27

标签: c++ visual-c++ mfc vtk

请参阅这篇文章:

VTK - Migrating from 6.1 to 8.2

我设置了所有设置,但只有3个错误,而且几天之内我都无法摆脱它们:

1>------ Build started: Project: MyApp, Configuration: Debug x64 ------
1>   Creating library F:\MyApp\x64\Debug\MyApp.lib and object F:\MyApp\x64\Debug\MyApp.exp
1>MyAppView.obj : warning LNK4217: locally defined symbol ??0vtkMFCWindow@@QEAA@PEAVCWnd@@@Z (public: __cdecl vtkMFCWindow::vtkMFCWindow(class CWnd *)) imported in function "protected: __int64 __cdecl CMyAppView::OnPostInit(unsigned __int64,__int64)" (?OnPostInit@CMyAppView@@IEAA_J_K_J@Z)
1>MyAppView.obj : warning LNK4217: locally defined symbol ??1vtkMFCWindow@@UEAA@XZ (public: virtual __cdecl vtkMFCWindow::~vtkMFCWindow(void)) imported in function "public: virtual void * __cdecl vtkMFCWindow::`scalar deleting destructor'(unsigned int)" (??_GvtkMFCWindow@@UEAAPEAXI@Z)
1>VTKView.obj : warning LNK4217: locally defined symbol ?DrawDC@vtkMFCWindow@@QEAAXPEAVCDC@@@Z (public: void __cdecl vtkMFCWindow::DrawDC(class CDC *)) imported in function "public: virtual void __cdecl CVTKView::OnDraw(class CDC *)" (?OnDraw@CVTKView@@UEAAXPEAVCDC@@@Z)
1>vtkRenderingOpenGL2-8.2.lib(vtkOpenGLState.obj) : error LNK2019: unresolved external symbol __imp_SymGetLineFromAddr64 referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl getProgramStack(void)" (?getProgramStack@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>vtkRenderingOpenGL2-8.2.lib(vtkOpenGLState.obj) : error LNK2019: unresolved external symbol __imp_SymInitialize referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl getProgramStack(void)" (?getProgramStack@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>vtkRenderingOpenGL2-8.2.lib(vtkOpenGLState.obj) : error LNK2019: unresolved external symbol __imp_SymFromAddr referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl getProgramStack(void)" (?getProgramStack@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>F:\MyApp\x64\Debug\MyApp.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "MyApp.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

您能否提示gt摆脱这些链接错误?

1 个答案:

答案 0 :(得分:2)

  • 使用dbghelp.lib

    链接您的二进制文件

    例如如果您使用的是CMake,请在CMakeLists.txt文件中添加类似以下内容的行

    target_link_libraries(${project_name} PRIVATE dbghelp.lib)

    或如果不使用CMake,则将其添加到项目中(链接器/输入/其他依赖项)

    或将以下内容添加到main.cpp中,包括以下位置

    #pragma comment(lib, "dbghelp.lib") //untested

  • 可能还会在VTK CMake中关闭VTK错误日志记录(不确定)

    VTK_REPORT_OPENGL_ERRORS [ ]