Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error "GLintptr has not been declared" when building VTK on Linux

When building VTK on Linux, I get the following error:

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
like image 307
Mildred Avatar asked Feb 27 '15 09:02

Mildred


1 Answers

The solution is to define GLX_GLXEXT_LEGACY during the build. This is done but commented in the file Rendering/vtkXOpenGLRenderWindow.cxx for VTK 5.x or Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx for VTK 6.x.

Either uncomment the line (this is for example an ArchLinux patch for the package):

--- 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"

Or, if you don't want to be invasive on the source code, you can add the flags to the compiler command line. For example by adding -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY to your cmake command line. Your cmake command will look like:

cmake -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY -Wno-dev ../VTK
like image 154
Mildred Avatar answered Oct 22 '22 22:10

Mildred