c++ - VTK - 从 6.1 迁移到 8.2 [2]

标签 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 ==========

你能给出一个提示来消除这些链接错误吗?

最佳答案

  • 将您的二进制文件与 dbghelp.lib 链接

    例如如果您使用的是 CMake,请将类似以下行的内容添加到您的 CMakeLists.txt

    target_link_libraries(${project_name} PRIVATE dbghelp.lib)

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

    或将以下内容添加到 main.cpp 中的某处,包括

    #pragma comment(lib, "dbghelp.lib")//未测试

  • 可能在 VTK CMake 中关闭 VTK 错误记录也可能有帮助(不确定)

    VTK_REPORT_OPENGL_ERRORS [ ]

关于c++ - VTK - 从 6.1 迁移到 8.2 [2],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55283069/

相关文章:

c++ - 将函数和成员函数传递给模板方法

c++ - 如何清除进程被阻止时发生的用户输入 (cin)?

c++ - "X is not a member of Y"即使 X 是 Y 的 friend ?

c - 如何避免 C 头文件覆盖 native C++ 类型

c++ - 自定义 MFC 窗口/对话框可以是类模板实例化吗?

c++ - 数组到C++函数(使用ASM)读取错误

c++ - "Magic static"在另一个翻译单元的静态销毁阶段引用时单例崩溃

c++ - VS 2008 : See the elements referred to pointer

c++ - 如何使用def文件在de dll中使用mfc

c++ - VS 2013 上的 v120_xp 和 v120 有什么区别?