User forums > Using Code::Blocks

GLUT

(1/2) > >>

Decrius:
Hi all, I want to make a simple window with GLUT, this is what I get when I compile it:

Project : OpenGL Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\C\Projects\GLUT_Window--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\C\Projects\GLUT_Window\GLUT.exe
.objs\main.o:main.cpp:(.text+0x48): undefined reference to `glutInit'
.objs\main.o:main.cpp:(.text+0x5c): undefined reference to `glutInitWindowPosition'
.objs\main.o:main.cpp:(.text+0x70): undefined reference to `glutInitWindowSize'
.objs\main.o:main.cpp:(.text+0x7c): undefined reference to `glutCreateWindow'
.objs\main.o:main.cpp:(.text+0x88): undefined reference to `glutDisplayFunc'
.objs\main.o:main.cpp:(.text+0x9f): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

The glut operations dont work for a weird reason. I Included the latest glut library file for the latest glut .dll file, and added the latest glut .h file. What could else be wrong?

Code:

#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/add/glut.h>

bool init()
{
return true;
}

void display()
{

}

int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(50, 50);
glutInitWindowSize(500, 500);
glutCreateWindow("01 - GLUT Window");
glutDisplayFunc(display);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}

Noone of the functions are working :S.

The linker files are:

-lopengl32
-lglu32
-lglut32 (or -lglut or -glut)

Any help will be appreciated :)

Decrius:
If I delete the glutInit(); function, the window appears, but has no inside color, it has the underlaying picture in the frame... if you get what I mean.

MortenMacFly:

--- Quote from: Decrius on March 18, 2006, 11:22:02 am ---Hi all, I want to make a simple window with GLUT, this is what I get when I compile it:

--- End quote ---
It might help if you post the complete compiler log, though. To enable it please go to Settings -> Compiler and debugger -> tab "Other" -> set the "Compiler logging" to "Full command line".
Furhtermore did you try the OpenGL template that ships with C::B? This really works and you'd only have to change this "hello OpenGL world" example to fit your purposes. It would also be very helpful if you could tell what version of C::B you are using. What OpenGL library are you using? The GLUT DevPak? Becasue if not you might want to try this - this is definetely compatible to C::B/MinGW (GCC).
Finally you could also search through the forum. There are plenty of OpenGL examples and issues that have already been provided and solved.
With regards, Morten.

Decrius:
Okay thx, is the OGL template one of the best and fastest window generations?

Decrius:
Its working now without any settings changement...weird.

Navigation

[0] Message Index

[#] Next page

Go to full version