glut my but (don't work) (few other questions also)

I am useing Dev-C++… and i have glut.h… but when i run this code it say that all my functions are undefined.

#include <GL/glut.h>
#include <stdlib.h>

void display(void)

glColor3f(1.0, 1.0, 1.0);
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);

void init(void)
glClearColor(0.0, 0.0, 0.0, 0.0);

glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

int main(int argc, char** argv)
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_ RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
return 0;

please help

I’m guessing you haven’t linked glut32.lib

i tried that and it still doesnt work.

Which functions does it say are undefined – the gl ones or the glut ones? Does it complain at link time or at compile time?

I can see two possible problems – it either can’t find glut.h, or you may have forgotten to link against opengl32.lib.

I don’t use Glut so I could be wrong…

Does GLUT Include gl.h? If not, then I’d say thats your problem…

Try including <gl/gl.h> and <gl/glu.h>

and linking to opengl32.lib and glu32.lib

Hope this helps

Doesn’t Dev-C++ use .a files instead of .lib files?

In any case, I think to add the libraries, somewhere you need to add -lGL -lglut -lGLU to the command-line parameters that Dev-C++ uses. I haven’t used Dev-C++ much myself, so I can’t tell you exactly where that goes, offhand.

Hi !

The latest versions of MinGW32 can use .lib files without problems, but older ones need .a files


ok… should i use glut or should i do it with windows API?

And what format of 3d objects does opengl mainly use? .obj? If so… is there an .obj texture program around… thanks

And the compiling… it just says that names all the functions and says they are undefined… i have tried everything

OpenGL has no support for any given file format. You have to do that on your own or use a 3rd party library.

The errors you are getting are likely linker errors, which means that you haven’t included the library to be linked into the project. Since you haven’t copy/pasted the exact error, this is just an educated guess, though.

As I said above, to link a library in you need to find out where to do that in the Dev-C++ project settings. Contrary to the belief of many new programmers, #include does not add a library, but just supplies a header file. (In the case of VC++ and Borland, however, there are #pragma statements that can be used to link in a library, however. Not sure of any equivalent for Dev-C++ off hand, though.)

Yea… i know… i can’t copy/paste the error with dev-c++. i am not a new programmer… i know the basic c++ console stuf and allegro but i want to get in 3d stuff… wher do you think i should start?

no one want to help?

Theres not much anyone can say to help, without more information. If you can’t copy and paste, give us an example (type it by hand) of the error. If the error is the always the same (with different filenames), give the error once and a list of the filenames.

Sorry I couldn’t be of more help.

And at no point does it say can’t find file glut.h?