View Full Version : glut my but (don't work) (few other questions also)

06-13-2002, 10:55 AM
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(&amp;argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_ RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
return 0;

please help

06-13-2002, 11:18 AM
I'm guessing you haven't linked glut32.lib

06-13-2002, 01:47 PM
i tried that and it still doesnt work.

06-13-2002, 05:32 PM
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.

06-14-2002, 12:53 AM
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

06-14-2002, 05:18 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

06-14-2002, 05:26 AM
Hi !

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


06-14-2002, 08:46 AM
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

06-14-2002, 08:51 AM
And the compiling... it just says that names all the functions and says they are undefined.... i have tried everything

06-14-2002, 09:55 AM
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.)

06-14-2002, 01:23 PM
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?

06-16-2002, 02:03 PM
no one want to help?

06-16-2002, 03:23 PM
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.

06-17-2002, 04:52 AM
And at no point does it say can't find file glut.h?