glutInit and posix threads

I’m trying to compile some ten-year-old code. This used to work
fine across several platforms. I’m now trying to compile it for
linux Fedora 7 using g++34 -Wno-deprecated. It throws the runtime

“Function <glutCreateWindow> called without first calling

I’ve read up a bit about this. Various sites say it’s a known bug
in the 0.8.1 SDK. So I installed the most recent version of
Mesa (7.0.2) and linked to that instead. Sadly I get the same
runtime error.

I’ve read about the possible fix

but unfortunately I don’t have access to any command-line
arguments at that point in the code. It runs on posix threads, so
there isn’t even a main function.

My questions are:

  1. Is there an up-to-date version of GL, freeglut, Mesa, call it
    what you like, that does not feature this bug?

  2. Are there any incompatibilities between glutInit and posix
    threads that I should be aware of?

  3. Any suggestions for how else I might fix the code?


Can’t you pass an empty char** pointer to argv and an int of value 0 to that fuction?

char** argv_ = 0;
int argc_ = 0;


glutInit access the name of the program using argv[0] so at least the first string within the array must be initialized.

Thanks to both. Yes, I’d tried to “fake” the presence of the command-line arguments, but it seemed to want proper modifiable values in there.

I’ve managed to get around this bug by working with openglut (instead of freeglut).