When compiling and running my GLFW-based C program under Ubuntu (9.04), it fails when trying to open the window (it compiles fine, having installed the latest GLFW). I've tried varying resolutions, going as low as 300x300, and left the bit depths to zeros, hoping a default will catch on.
The relevant piece of code reads (directly snipped from the top of my main file, based on the example file gears.c
):
// File: main.c
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glfw.h>
#ifndef PI
#define PI 3.141592654
#endif
int main(int argc, char* argv[])
{
// Initialize GLFW:
glfwInit();
if (!glfwOpenWindow(300, 300, 0, 0, 0, 0, 0, 0, GLFW_WINDOW)) // Yo failure!
{
printf("Window open failed.\n");
glfwTerminate();
return 0;
}
glfwSetWindowTitle("...");
...
// Clean up:
glfwTerminate();
return 0;
}
Other noteworthy facts are:
- Running Ubuntu inside VirtualBox 3.0.2, config'd w/ 512 MB RAM, 3D acceleration enabled, 64 MB VRAM, Guest Additions successfully installed
glxgears
works fine, even > 300 FPS- built GLFW using
make-x11
makefile command line:
gcc 'pkg-config --cflags libglfw' main.c -o program 'pkg-config --libs libglfw' -lglfw -lGLU -lGL -lm
(where the 's should be replaced with single backwards apostrophes, problems formatting)
- Mark's tip on http://stackoverflow.com/questions/746000/c-glfw-window-doesnt-open-on-debian does not seem to alleviate the situation
I'm almost tearing my hair out on this, as it's my first GLFW program on Linux (being happy with Tao and C# on Windows) I've barely got started on it and I'm not able to get the most basic things working.
Edit:
Are there any way to extract a more fancy error message? Any getLastErrorDesc()
or debug log files?