Problem. Help me!

Hy,

I´m starting with OpenGL and using DevC++. Well, I am tryng to compile the code for hello.c but I get the messages when use glut.h:

[Linker error] undefined reference to _imp__glClear' [Linker error] undefined reference to_imp__glClear’
[Linker error] undefined reference to `_imp__glBegin’

My code is:

#include<gl/glut.h>
#include<gl/gl.h>

/* Função para desenhar um polígono */

void display (void) {

/* Limpar pixels */
glClear(GL_COLOR_BUFFER_BIT);
/* Desenha o polígono */
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
    glVertex3f(0.25, 0.25, 0.0);
    glVertex3f(0.75, 0.25, 0.0);
    glVertex3f(0.75, 0.75, 0.0);
    glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();

}

void init(void) {

/* inicia o ambiente: cor de fundo da janela e valores de visualização */
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);

}

/* Decalara o tamanho inicial da janela, posição modo de visualização
single buffer e RGB. Abre a janela com Hello.
*/

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

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(150,150);
glutWindowPosition(100,100);
glutCreateWindow("Hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;

}

What is the problem?

Alanperes :confused:

add glut32.dll (windows) or libglut.a in ur linking path while linking ur program. probably this would solve the problem.