Zach Smith
Zach Smith

Reputation: 133

Basic Open GL/GLUT Issue

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 however 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

Upvotes: 0

Views: 500

Answers (2)

mrucci
mrucci

Reputation: 4470

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!

Upvotes: 2

Adam Paynter
Adam Paynter

Reputation: 46938

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;
}

Upvotes: 2

Related Questions