Problems with OpenGL(glut) in C++

This is a discussion on Problems with OpenGL(glut) in C++ within the Windows Programming forums, part of the Platform Specific Boards category; Okay, first of all...please don't bother posting if you're just going to say "www.google.com" or "search", because i have tried ...

Problems with OpenGL(glut) in C++

Okay, first of all...please don't bother posting if you're just going to say "www.google.com" or "search", because i have tried those and either way they don't help.
Now to my problem...can someone explain a step by step tutorial that makes a program that uses glut in Open GL (such as glutinitwindow). Everything i have searched hasn't worked for me, so maybe it's that i am missing something. Having said that don't expect me to know ANYTHING about projects, linkers, etc... because i think i AM missing something. If you need to know what kind of errors I am getting they are usually either a "[build error]" or a "[linker error]".

Well, undefined references mean that the linker can't find those functions. That in turn usually means that there's something wrong with the list of libraries that you are including. But if you think that all you are doing is exactly right, I guess it's time to look at everything very closely again.

Perhaps also google or post the EXACT error messages. It may be something that someone else recognizes with that particular message.

[Linker error] undefined reference to '_glutInitWithExit'
[Linker error] undefined reference to '_glutCreateWindowWithExit'
[Linker error] undefined reference to '_glutCreateMenuWithExit'
[Linker error] undefined reference to '_imp__glEnable'
ld return 1 exit status
[Build Error] ["2-Setting] Error 1
The problem could be in the project as i am unsure as to if im doing THAT part right. I basically made a project with all the linkers included and made a file with the libraries + compile & run...

the h files go in the include folder, not in the library folder. like include/stdio.h and lib/libc.a

libraries and header files are different things. header files just contain some information about the libraries.

So in order to use a library, you need to do two thing: include the header file, and link wih the library.

like this:

Code:

#include < mylib.h>
int main()
{ blah blah return 0; }

Code:

gcc t.c -lmylib

the -lmylib makes the compiler use the code from libmylib.a and use it with your program to make the program file.

So you need to include the glut header file (I think you've done that) and then make sure your IDE has the glut library in the linker settings so that it will know what the heck the header file is talking about.

Also, you don't have to manually put anything in the GL header file directory. How did you install GLUT and GL?

yes sorry i was confused. Correction- the include folder. And about the linker settings, is that the same thing as project options->parameters->linker? Because if it is i have -lglut in there but maybe -lglut isnt even the library...