Advertisement

Problems with <GL/glx.h>

Started by April 08, 2004 01:35 PM
2 comments, last by LonelyStar 20 years, 5 months ago
Hi everybody, This simple progamm illustrates the Problem:

#include <GL/glx.h>

int Status;

int main(void) 
{
  return 0;
}
if I know do gcc main.cc I get: main.cc:3: error: redeclaration of C++ built-in type `int' That is annoying, because I like to call Variables "State". I guess the solution would be not call the Variable "State" but does anybody know a more elegant solution? Thanks! edit: It only happens if you have an *.cc file (or if you use g++ main.cc) [edited by - LonelyStar on April 8, 2004 2:44:24 PM]
Solution:

extern "C" {
#include <GL/glx.h>
}

Most headers will do a #ifdef __cplusplus or something like that and will extern "C" for you, but apparently your GLX does not.

so do it manually.
Advertisement
C-Junkie, you are my hero!
Thanks a lot!!!
another solution would be to include all your code into a namespace declaration. this way you don''t have to touch/#ifdef headers

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

This topic is closed to new replies.

Advertisement