troubles with getting opengl to work

hi all. i am running gcc on mingw32 with the eclipse ide. im linked to the following libraries: glu32, freeglut32, opengl32, glew32. here is my code:

#include <GL/glew.h>
#include <GL/glu.h>
#include <GL/gl.h>
#include <GL/freeglut.h>
#include <stdio.h>

void init();

int main(int argc, char **argv) {

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);


    if (glewInit()) {

    // if GLEW is found, the program will show a "dirty" window.
    // if not, the window will only be shown only for a split second.

    return 0;


void init()
	 GLuint prog = glCreateProgram();

	    // This is the rendering vertex shader
	    static const char vshader[] =
	    		"#version 430 core"
	    		"layout (location = 0) in vec4 vPosition;"
	    		"void main()"
	    		"	gl_Position = vPosition;"

	    // Simple fragment shader
	    static const char fshader[] =
	    		"#version 430 core"
	    		"out vec4 fcolor;"
	    		"void main()"
	    		"	fColor = vec4 (0.0, 0.0, 1.0, 1.0);"

	    // Compile and link like normal
	    vglAttachShaderSource(prog, GL_VERTEX_SHADER, vshader);
	    vglAttachShaderSource(prog, GL_FRAGMENT_SHADER, fshader);


im getting these errors:

undefined reference to `_imp____glewCreateProgram’ main.c /test line 32 C/C++ Problem

undefined reference to `_imp____glewLinkProgram’ main.c /test line 56 C/C++ Problem

undefined reference to `_imp____glewUseProgram’ main.c /test line 57 C/C++ Problem

undefined reference to `vglAttachShaderSource’ main.c /test line 53 C/C++ Problem

undefined reference to `vglAttachShaderSource’ main.c /test line 54 C/C++ Problem

any idea on how to solve them?

i now understand that vglAttachShaderSource is simply not a function, but what about the other 2?

i figured it out. i just had to recompile the glew source. YYYYYYYYYYYYYEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSS! :slight_smile: