I am studying graphics and currently using OpenGL with GLUT. Doing my editing in codeblocks and using an online tutorial located at lighthouse3d. I am using the main method declared on that page howev开发者_JS百科er it will not let me compile. The error message consists of the main method not returning an int, I have "played" with the code enough to say I am confused. The GLUT Library is installed, and I do not see where the error is coming from.
Thank you, Zach Smith
You probably have a method like this:
void main(int argc, char** argv) {
// The code...
}
Change it to this:
int main(int argc, char** argv) {
// The code...
return 0;
}
The problem is that you are not linking the needed libraries.
Go to the project properties by right clicking on the project icon in the 'Solution Explorer' and click on 'Properties'. Then go under 'Configuration Properties' -> 'Linker' -> 'Input' and add the following libraries to the 'Additional Dependencies' field:
opengl32.lib glut32.lib glu32.lib
Rebuild your project and all should be fine!
精彩评论