Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

can't get GLUT to work in Dev C++ 4.9.8.4 please help!!

Okay, I H-A-T-E windows programing. I want to use OpenGL in a console app like I can with DirectX. So went online and ran a search, found some base code for a console GLUT app and cut/pasted it into Dev C++. This is the code:
#include

void Display( void )
{
glClearColor( 0, 0, 0, 1 );
glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glOrtho( 0, 1, 0, 1, -1, 1 );

glShadeModel( GL_SMOOTH );
glBegin( GL_QUADS );
glColor3f( 1, 0, 0 );
glVertex3f( 0, 0, 0 );
glColor3f( 0, 1, 0 );
glVertex3f( 0, 1, 0 );
glColor3f( 0, 0, 1 );
glVertex3f( 1, 1, 1 );
glColor3f( 1, 1, 1 );
glVertex3f( 1, 0, 0 );
glEnd();
glFlush();
}

int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 300, 300 );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGBA );

glutCreateWindow( "Testing OpenGL!" );
glutDisplayFunc( Display );

glutMainLoop();
return 0;
}

I also included the Library files with Project Options->Parameters->Add Library or Object. The library files were: libopengl32.a, libglu32.a, and ibglut32.a. with all that set up I fired up the compiler and got:

Compiler: Default compiler
Building Makefile: "C:Dev-CppMakefile.win"
Executing make...
make.exe -f "C:Dev-CppMakefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"

g++.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" lib/libopengl32.a lib/libglu32.a lib/libglut32.a

lib/libglut32.a(glut_event.o)(.text+0x319):glut_event.c: undefined reference to `glFinish@0'
lib/libglut32.a(glut_event.o)(.text+0x374):glut_event.c: undefined reference to `wglSwapBuffers@4'
lib/libglut32.a(glut_event.o)(.text+0x3dc):glut_event.c: undefined reference to `wglSwapBuffers@4'
lib/libglut32.a(glut_win.o)(.text+0x18f):glut_win.c: undefined reference to `wglGetCurrentContext@0'
lib/libglut32.a(glut_win.o)(.text+0x196):glut_win.c: undefined reference to `wglGetCurrentDC@0'
lib/libglut32.a(glut_win.o)(.text+0x1b6):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0x1d5):glut_win.c: undefined reference to `glViewport@16'
lib/libglut32.a(glut_win.o)(.text+0x1f7):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0x216):glut_win.c: undefined reference to `glViewport@16'
lib/libglut32.a(glut_win.o)(.text+0x21e):glut_win.c: undefined reference to `wglGetCurrentContext@0'
lib/libglut32.a(glut_win.o)(.text+0x225):glut_win.c: undefined reference to `wglGetCurrentDC@0'
lib/libglut32.a(glut_win.o)(.text+0x241):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0x631):glut_win.c: undefined reference to `ChoosePixelFormat@8'
lib/libglut32.a(glut_win.o)(.text+0x64a):glut_win.c: undefined reference to `SetPixelFormat@12'
lib/libglut32.a(glut_win.o)(.text+0x843):glut_win.c: undefined reference to `wglGetCurrentContext@0'
lib/libglut32.a(glut_win.o)(.text+0x84a):glut_win.c: undefined reference to `wglGetCurrentDC@0'
lib/libglut32.a(glut_win.o)(.text+0x866):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0x897):glut_win.c: undefined reference to `glDrawBuffer@4'
lib/libglut32.a(glut_win.o)(.text+0x8a6):glut_win.c: undefined reference to `glReadBuffer@4'
lib/libglut32.a(glut_win.o)(.text+0xaa1):glut_win.c: undefined reference to `wglDeleteContext@4'
lib/libglut32.a(glut_win.o)(.text+0xb61):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0xbd2):glut_win.c: undefined reference to `wglGetCurrentContext@0'
lib/libglut32.a(glut_win.o)(.text+0xbd9):glut_win.c: undefined reference to `wglGetCurrentDC@0'
lib/libglut32.a(glut_win.o)(.text+0xbf5):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_win.o)(.text+0xcb4):glut_win.c: undefined reference to `wglGetCurrentContext@0'
lib/libglut32.a(glut_win.o)(.text+0xcbb):glut_win.c: undefined reference to `wglGetCurrentDC@0'
lib/libglut32.a(glut_win.o)(.text+0xcd7):glut_win.c: undefined reference to `wglMakeCurrent@8'
lib/libglut32.a(glut_mesa.o)(.text+0x80):glut_mesa.c: undefined reference to `glGetString@4'
lib/libglut32.a(glut_mesa.o)(.text+0x91):glut_mesa.c: undefined reference to `glGetString@4'
lib/libglut32.a(glut_util.o)(.text+0x281):glut_util.c: undefined reference to `glGetError@0'
lib/libglut32.a(glut_util.o)(.text+0x28d):glut_util.c: undefined reference to `gluErrorString@4'
lib/libglut32.a(win32_x11.o)(.text+0x1f):win32_x11.c: undefined reference to `GetPixelFormat@4'
lib/libglut32.a(win32_x11.o)(.text+0x44):win32_x11.c: undefined reference to `DescribePixelFormat@16'
lib/libglut32.a(win32_x11.o)(.text+0xc0):win32_x11.c: undefined reference to `GetSystemPaletteEntries@16'
lib/libglut32.a(win32_x11.o)(.text+0x374):win32_x11.c: undefined reference to `CreatePalette@4'
lib/libglut32.a(win32_x11.o)(.text+0x39b):win32_x11.c: undefined reference to `SelectPalette@12'
lib/libglut32.a(win32_x11.o)(.text+0x3ac):win32_x11.c: undefined reference to `RealizePalette@4'
lib/libglut32.a(win32_x11.o)(.text+0x889):win32_x11.c: undefined reference to `DescribePixelFormat@16'
lib/libglut32.a(win32_x11.o)(.text+0x903):win32_x11.c: undefined reference to `DescribePixelFormat@16'
lib/libglut32.a(win32_x11.o)(.text+0x976):win32_x11.c: undefined reference to `SetPaletteEntries@16'
lib/libglut32.a(win32_x11.o)(.text+0x994):win32_x11.c: undefined reference to `UnrealizeObject@4'
lib/libglut32.a(win32_x11.o)(.text+0x9b1):win32_x11.c: undefined reference to `SelectPalette@12'
lib/libglut32.a(win32_x11.o)(.text+0x9c2):win32_x11.c: undefined reference to `RealizePalette@4'
lib/libglut32.a(win32_x11.o)(.text+0x9fc):win32_x11.c: undefined reference to `SelectPalette@12'
lib/libglut32.a(win32_x11.o)(.text+0xa07):win32_x11.c: undefined reference to `RealizePalette@4'

lib/libglut32.a(win32_x11.o)(.text+0xb1f):win32_x11.c: undefined reference to `GetDeviceCaps@8'
lib/libglut32.a(win32_x11.o)(.text+0xb7f):win32_x11.c: undefined reference to `GetDeviceCaps@8'
lib/libglut32.a(glut_cmap.o)(.text+0x255):glut_cmap.c: undefined reference to `DeleteObject@4'
lib/libglut32.a(win32_glx.o)(.text+0x1f7):win32_glx.c: undefined reference to `ChoosePixelFormat@8'
lib/libglut32.a(win32_glx.o)(.text+0x22c):win32_glx.c: undefined reference to `DescribePixelFormat@16'
lib/libglut32.a(win32_glx.o)(.text+0x30d):win32_glx.c: undefined reference to `wglCreateContext@4'
lib/libglut32.a(glut_swap.o)(.text+0x71):glut_swap.c: undefined reference to `wglSwapBuffers@4'
lib/libglut32.a(win32_winproc.o)(.text+0x1d7):win32_winproc.c: undefined reference to `GdiFlush@0'
lib/libglut32.a(win32_winproc.o)(.text+0x292):win32_winproc.c: undefined reference to `joyReleaseCapture@4'
lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_winproc.c: undefined reference to `joySetCapture@16'
lib/libglut32.a(win32_winproc.o)(.text+0x1562):win32_winproc.c: undefined reference to `UnrealizeObject@4'
lib/libglut32.a(win32_winproc.o)(.text+0x1586):win32_winproc.c: undefined reference to `SelectPalette@12'
lib/libglut32.a(win32_winproc.o)(.text+0x1598):win32_winproc.c: undefined reference to `RealizePalette@4'
lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_winproc.c: undefined reference to `joyGetPosEx@8'
lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_winproc.c: undefined reference to `joyGetPosEx@8'
lib/libglut32.a(glut_get.o)(.text+0x5d6):glut_get.c: undefined reference to `GetPixelFormat@4'
lib/libglut32.a(win32_menu.o)(.text+0x4a7):win32_menu.c: undefined reference to `GdiFlush@0'

make.exe: *** [Project1.exe] Error 1

Execution terminated
------------------------------------------------------------------------
So what gives? I've done just about all that I know to do. I've added includes for gl.h, glu.h, glaux.h, and even windows.h. Nothing has worked. Is GLUT just boken in Dev C++? I'm totally lost.

Comments

  • ScorpiusScorpius Member Posts: 1
    I have the exact same problem. I have tried to deal with this problem for weeks. I have searched so many forums for help on this, and i suspect that it's either a problem with Dev-Cpp and all that extra overhead crap you get when you compile, or else it's a problem with the g++ linker itself.

    If i find a sol'n i'll post it up. I dont like the new version of Dev-cpp, but you could always try the update and see.

    Scorpius
  • brionnachbrionnach Member Posts: 1
    Hi jscythe,

    I had this problem, and have figured out how to solve it.

    In Dev-C++ (v 4.9.9.2):

    - Open the Project menu
    - Select "Project Options"
    - In the "General" tab, change the application type to "Win32 GUI"

    Hope this helps.

    Thanks,
    brionnach
  • blechblech Member Posts: 1
    I just had this same problem, and it turned out that the functions were in libopengl32.a, but you have to put it _after_ the other libraries that use it, like this:

    [code]
    g++.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" lib/libglu32.a lib/libglut32.a lib/libopengl32.a
    [/code]

    or even:

    [code]
    g++.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -lglu32 -lglut32 -lopengl32
    [/code]
Sign In or Register to comment.