I'm writing an OpenGL application using SDL as my windowing library, but I'm getting a crash (process terminated with status 3) when I call glGenBuffers. I've used gl* calls before this point with no problem, but as soon as i use glGenBuffers, I crash. I've tried searching for the problem on Google, and nearest I can tell, it's causing a segfault somewhere, but I really don't know where it's happening.

Here are my #includes,
Code :
#define NO_SDL_GLEXT
#include "gl/glew.h"
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <stdint.h>
#include <cmath>

Here's main(),
Code :
int main(int argc, char* argv[])
   Application* app = new Application(640, 480);
   OpenGL* gl = new OpenGL(app);
   while (app->InputLoop())
   delete app;
   return 0;

Here's the constructor for my Application class,
Code :
Application::Application(int width, int height)
:  screen(NULL),
   /* Initialize SDL. */
   /* Set SDL_GL attributes. */
   SDL_GL_SetAttribute(SDL_GL_RED_SIZE,   8);
   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,  8);
   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
   SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);
   /* Create our screen. */
   screen = SDL_SetVideoMode(width, height, 32, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL);
   if (screen == NULL)
   SDL_WM_SetCaption("OpenGL Test", NULL);
   running = true;

and here's the constructor for my OpenGL class:
Code :
OpenGL::OpenGL(Application* App)
:  app(App),
   /* If this check returns false, it means that the OpenGL class was created before the Application,
      or after the main loop has already ended. */
   if (app->isRunning() == false)
   /* Grab the screen dimensions. */
   width = app->getWidth();
   height = app->getHeight();
   GLenum err = glewInit();
   if (err != GLEW_OK)
      printf("! ERROR: '%s'\n", glewGetErrorString(err));
   glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   glViewport(0, 0, width, height);
   float vertex[3] = {0.0f, 0.0f, 0.0f};
   GLuint vbo = 0;
   glGenBuffers(1, &vbo); //[B] <- this causes a crash![/B]
   //glBindBuffer(GL_ARRAY_BUFFER, vbo);
   //glBufferData(GL_ARRAY_BUFFER, sizeof(vertex), vertex, GL_STATIC_DRAW);
   //glBindBuffer(GL_ARRAY_BUFFER, vbo);
   //glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

When I comment out glGenBuffers, the application runs fine, I get a black window as expected. When it's uncommented, I get a white window for about 1/10 of a second, it closes, and I get a status of 3. glGenBuffers is the first function I use which comes from an extension, so I investigated GLEW to see if the problem lied there. I tried grabbing the function pointer myself with glext, but the exact same crash happened, in the exact same spot. My libraries are "-lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32", with glew.c simply added to the project and linked statically.

My IDE is Code::Blocks on Windows 7 64-bit, using GNU GCC Compiler, with an updated version of MinGW. I use the -g and -Wall flags, but the only warnings I get are the hundreds from glew.c that I always get from glew.c - The only warnings from my code are about unused variables.