vtkRenderer 错误 [英] Error with vtkRenderer
问题描述
我是 vtk 的新手,所以我首先使用 CMake 和 Visual Studio 2017 构建 vtk 8.1.1,使用默认选项和示例.
许多示例运行良好,但其中一些给出了错误:
这是 CreateTree 示例,但 HelloWorld 给出了相同的错误.
我不知道是否与
I'm new to vtk, so I started by building vtk 8.1.1 with CMake and Visual Studio 2017, with the default options and the examples.
Many of the examples runs fine, but some of them gives an error:
This one is the CreateTree example, but the HelloWorld gives the same error.
I don't know if it has something to do with this issue.
I've also tried the solution from this question and this one. But when I add
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
right after all the includes, Visual Studio gives me this error:
1>CreateTree.obj : error LNK2019: unresolved external symbol "void __cdecl vtkRenderingOpenGL2_AutoInit_Construct(void)" (?vtkRenderingOpenGL2_AutoInit_Construct@@YAXXZ) referenced in function "public: __thiscall vtkRenderingOpenGL2_ModuleInit::vtkRenderingOpenGL2_ModuleInit(void)" (??0vtkRenderingOpenGL2_ModuleInit@@QAE@XZ)
1>CreateTree.obj : error LNK2019: unresolved external symbol "void __cdecl vtkRenderingOpenGL2_AutoInit_Destruct(void)" (?vtkRenderingOpenGL2_AutoInit_Destruct@@YAXXZ) referenced in function "public: __thiscall vtkRenderingOpenGL2_ModuleInit::~vtkRenderingOpenGL2_ModuleInit(void)" (??1vtkRenderingOpenGL2_ModuleInit@@QAE@XZ)
1>C:\vtkSource\bin\bin\Debug\CreateTree.exe : fatal error LNK1120: 2 unresolved externals
if I try VTK_MODULE_INIT(vtkRenderingWindow)
or VTK_MODULE_INIT(vtkRenderingOpenGL)
I get the same errors.
Also, examples like Delaunay3D only open a window that closes so fast I can't even see what it does have.
Did you try adding the following line
vtkRendering${VTK_RENDERING_BACKEND}
to the set(VTK_Modules ...)
command in the CMakeLists.txt
for the HelloWorld
or CreateTree
projects just like it is suggested in the link you posted.
EDIT
Just to expand the explanation for beginners, the CMakeLists.txt
is the path VTK-8.1.1\Examples\Infovis\Cxx
. And the file should look like this:
这篇关于vtkRenderer 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!