User forums > Using Code::Blocks

Stupid Question

<< < (3/7) > >>

FlyingIsFun1217:
How stupid of me to think that the editor had an include folder :P

Thanks so much! I really appreciate your help!

FlyingIsFun1217

FlyingIsFun1217:
Ok, I seem to be able to get it set up fairly well, except for one thing.
In some sample code provided by a tutorial at lighthouse3d.com, the following code


--- Code: ---#include <GL/glut.h>

void main(int argc, char **argv)
 {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
}
--- End code ---

Gives me the error:


--- Quote ---C:\Documents and Settings\tanner\Desktop\CodeBlocks\Projects\GLUT-Test\GLUT-Test.cpp:4: error: `main' must return `int'
C:\Documents and Settings\tanner\Desktop\CodeBlocks\Projects\GLUT-Test\GLUT-Test.cpp:4: error: return type for `main' changed to `int'
:: === Build finished: 2 errors, 0 warnings ===

--- End quote ---

I assume that this is a code error? If it's a setup error, how do I fix this?

Thanks!
FlyingIsFun1217

Biplab:
Try the following:


--- Code: ---#include <GL/glut.h>

int main(int argc, char **argv)
 {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
        return 0;
}
--- End code ---

Auria:

--- Quote from: FlyingIsFun1217 on March 17, 2007, 04:00:28 pm ---error: `main' must return `int'

--- End quote ---

Sounds explicit to me ;)

FlyingIsFun1217:
Yes, it seems that I pasted code without thinking first. Forgot the return statement!
After replacing my glut files and restarting codeblocks, I seem to have everything right, but now I get:


--- Quote ---objects\main.o:main.c:(.text+0x2f):: undefined reference to `__glutInitWithExit'
objects\main.o:main.c:(.text+0x3b):: undefined reference to `glutInitDisplayMode'
objects\main.o:main.c:(.text+0x50):: undefined reference to `glutInitWindowPosition'
objects\main.o:main.c:(.text+0x65):: undefined reference to `glutInitWindowSize'
objects\main.o:main.c:(.text+0x7a):: undefined reference to `__glutCreateWindowWithExit'
:: === Build finished: 5 errors, 0 warnings ===

--- End quote ---

This sure seems to be something with minGW not recognizing something of glut's?

Thanks again for your help!
FlyingIsFun1217

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version