在
Linux上构建VTK时,我收到以下错误:
In file included from /usr/include/GL/glx.h:333:0,from /home/mildred/Work/3DKF/VTK/Rendering/vtkXOpenGLRenderWindow.cxx:31: /usr/include/GL/glxext.h:480:143: error: ‘GLintptr’ has not been declared
解决方法
解决方案是在构建期间定义GLX_GLXEXT_LEGACY.这已完成,但在VTK 5.x的Rendering / vtkXOpenGLRenderWindow.cxx文件或VTK 6.x的Rendering / OpenGL / vtkXOpenGLRenderWindow.cxx中进行了注释.
取消注释该行(这是例如包的ArchLinux补丁):
--- a/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx.orig 2014-11-23 22:16:50.000000000 +0100 +++ b/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx 2014-11-23 22:16:59.000000000 +0100 @@ -27,7 +27,7 @@ // define GLX_GLXEXT_LEGACY to prevent glx.h to include glxext.h provided by // the system -//#define GLX_GLXEXT_LEGACY +#define GLX_GLXEXT_LEGACY #include "GL/glx.h" #include "vtkgl.h"
或者,如果您不想侵入源代码,可以将标志添加到编译器命令行.例如,通过向cmake命令行添加-DCMAKE_C_FLAGS = -DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS = -DGLX_GLXEXT_LEGACY.你的cmake命令看起来像:
cmake -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY -Wno-dev ../VTK