View Full Version : glutInit and posix threads

02-28-2008, 07:27 AM
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?


02-28-2008, 12:14 PM
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;


02-28-2008, 01:07 PM
glutInit access the name of the program using argv[0] so at least the first string within the array must be initialized.

02-29-2008, 04:53 AM
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).