SDL and GLew conflict

Hi all. I’m developing a game for linux using SDL 1.2 (switching to 2.0 soon) and OpenGL (including glew and glm) in C++. On my 64 bit machine it compiles properly, but one of the testers (on 64bit) gets the following error:

Code:

In file included from /usr/include/SDL/SDL_main.h:26:0,
from /usr/include/SDL/SDL.h:30,
from main.cpp:11:
/usr/include/SDL/SDL_stdinc.h:106:9: error: reference to “int64_t” is ambiguous
typedef int64_t Sint64;
^
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdint.h:9:0,
from /usr/include/GL/glew.h:224,
from main.cpp:4:
/usr/include/stdint.h:40:19: note: candidates are: typedef long int int64_t
typedef long int int64_t;
^
In file included from /usr/include/glm/glm.hpp:88:0,
from main.cpp:8:
/usr/include/glm/fwd.hpp:305:24: note: typedef glm::detail::int64 glm::int64_t
typedef detail::int64 int64_t;
^
In file included from /usr/include/SDL/SDL_main.h:26:0,
from /usr/include/SDL/SDL.h:30,
from main.cpp:11:
/usr/include/SDL/SDL_stdinc.h:106:9: error: “int64_t”?? does not name a type
typedef int64_t Sint64;

An obvious workaround is to edit SDL_stdinc.h but I want to avoid that since I’m going to distribute the game. Is there a way to fix the error?

I haven’t been using glm before, so I might be wrong. Looks like the int64_t typedef in fwd.h (of glm) is declared inside glm namespace. That should prevent name clashing.

Are you happen to use :-

Code:
using namespace glm;

somewhere in your code ? If so, you might want to remove that. You’d have to append glm:: in front of every glm’s function calls.

It’s suggested against using “using namespace” in production code. It creates more problems than benefits.

You’re right. Moving that after the sdl includes solved the problem. I still do not understand why it worked fine on my system and not on another, but now it’s all ok. Thank you.