Problem with OpenGL tutorial

This is a discussion on Problem with OpenGL tutorial within the Windows Programming forums, part of the Platform Specific Boards category; Originally Posted by Ken Fitlike Same idea with dev-cpp (mingw) - link with the correct libs (-lopengl32 and -glu32). Also ...

  1. #16
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Quote Originally Posted by Ken Fitlike
    Same idea with dev-cpp (mingw) - link with the correct libs (-lopengl32 and -glu32). Also remove/comment out msvc specific stuff, such as the #pragmas; #include <glaux.h> is also one included header too many; that should just about do it with respect to dev-cpp and the code you posted.
    If you didn't notice that before, there it is. You would use -lopengl32 to link libopengl32.a to your project and -lglu32 to link libglu32.a in the same fashion. In dev-c++ you do this by going to linker options and adding this that to the linker commands.

    I think its slightly different between the newer and older versions of dev-c++, thus you should be specific as to which you use if you need a more thorough explaination.

  2. #17
    C++ newbie
    Join Date
    Sep 2004
    Posts
    9
    i tried it with my old Dev-C++ 4 compiler, but there were different errors now. It didn't say anything about the glaux.h file, but instead said this:

    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)':
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:585: `CDS_FULLSCREEN' undeclared (first use this function)
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:585: (Each undeclared identifier is reported only once
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:585: for each function it appears in.)
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:622: warning: converting NULL to non-pointer type
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:638: warning: converting NULL to non-pointer type
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.cpp:638: warning: converting NULL to non-pointer type

    do you think that the function does not exist in my header files?
    I also tried to insert the prototype in the beginning of the code, but i dont know what type it returns.

    oh, now i found something in the linker section too:

    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x b):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 15):main.cpp: undefined reference to `glBegin@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 26):main.cpp: undefined reference to `glVertex3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 41):main.cpp: undefined reference to `glVertex3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 66):main.cpp: undefined reference to `glVertex3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 81):main.cpp: undefined reference to `glVertex3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 92):main.cpp: undefined reference to `glVertex3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x ad):main.cpp: more undefined references to `glVertex3f@12' follow
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 309):main.cpp: undefined reference to `glEnd@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 30e):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 323):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 334):main.cpp: undefined reference to `glColor3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 35a):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 37b):main.cpp: undefined reference to `glScalef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 394):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 3af):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 3c6):main.cpp: undefined reference to `glColor3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 3ec):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 41b):main.cpp: undefined reference to `glScalef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 434):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 453):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 464):main.cpp: undefined reference to `glColor3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 48a):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 4b2):main.cpp: undefined reference to `glScalef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 4cb):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 4e3):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 4f7):main.cpp: undefined reference to `glColor3f@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 51d):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 53e):main.cpp: undefined reference to `glScalef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 557):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 58b):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 5ae):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 5ef):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 671):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 68e):main.cpp: undefined reference to `glRotatef@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 6b8):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 6bd):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 704):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 721):main.cpp: undefined reference to `glRotatef@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 74b):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 750):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 7d1):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 7ee):main.cpp: undefined reference to `glRotatef@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 822):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 827):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 8a7):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 8c4):main.cpp: undefined reference to `glRotatef@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 8f8):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 8fd):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 91f):main.cpp: undefined reference to `glEnable@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 92f):main.cpp: undefined reference to `glClearColor@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 93c):main.cpp: undefined reference to `glClear@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 944):main.cpp: undefined reference to `glLoadIdentity@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 97d):main.cpp: undefined reference to `glPushMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 982):main.cpp: undefined reference to `glLoadIdentity@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 99a):main.cpp: undefined reference to `glTranslatef@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 9b7):main.cpp: undefined reference to `glRotatef@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 9cd):main.cpp: undefined reference to `glPopMatrix@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 9d2):main.cpp: undefined reference to `glFlush@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x 9e0):main.cpp: undefined reference to `SwapBuffers@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x a07):main.cpp: undefined reference to `ChoosePixelFormat@8'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x a24):main.cpp: undefined reference to `SetPixelFormat@12'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x abb):main.cpp: undefined reference to `wglCreateContext@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x ad9):main.cpp: undefined reference to `wglMakeCurrent@8'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x afc):main.cpp: undefined reference to `wglMakeCurrent@8'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x b0d):main.cpp: undefined reference to `wglDeleteContext@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x b5d):main.cpp: undefined reference to `glViewport@16'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x b6a):main.cpp: undefined reference to `glMatrixMode@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x b72):main.cpp: undefined reference to `glLoadIdentity@0'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x ba4):main.cpp: undefined reference to `gluPerspective@32'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x bb1):main.cpp: undefined reference to `glMatrixMode@4'
    c:\documents and settings\tobias\mina dokument\spel\bwg\opengl\thingy001\main.o(.text+0x bb9):main.cpp: undefined reference to `glLoadIdentity@0'

    eh, i think i'm goin to start trying DirectX instead.

  3. #18
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>It didn't say anything about the glaux.h file<<

    Glaux is excess baggage in that example, nothing more.

    >>Dev-C++ 4 compiler<<

    This is ancient and, to the best of my knowledge, uses gcc 295.x and many outdated headers. Download the latest (v4.9.9.0) of dev-cpp 5 which includes a more recent version of the MinGW compiler and tools.

    In the meantime, you can hack around:
    >>`CDS_FULLSCREEN' undeclared <<
    with:
    Code:
    #if !defined CDS_FULLSCREEN
    #define CDS_FULLSCREEN 4
    #endif
    but it would be much better to update your copy of dev-cpp.

    >>undefined reference to ...... <<

    You have been advised repeatedly in this thread that these linker errors occur because you have not linked against the proper opengl libraries. Once more: you must link with (for any version of dev-cpp) libopengl32.a and libglu32.a, more commonly by using the linker switch shorthand of -lopengl32 and -lglu32.

    >>eh, i think i'm goin to start trying DirectX instead.<<

    Before you do that you might want to consider that configuring and using DirectX with Dev-cpp is a lot more involved that using opengl with dev-cpp.

    Good luck anyway.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #19
    C++ newbie
    Join Date
    Sep 2004
    Posts
    9
    well i dont know how to link very well, i think im gonna learn that and console programming, and i am using the latest dev-c++ normally, just wanted to test it in the old one.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. first opengl game, problems.
    By n3v in forum Game Programming
    Replies: 1
    Last Post: 07-11-2006, 09:22 PM
  2. Newbie opengl display problem.
    By godhand in forum Game Programming
    Replies: 1
    Last Post: 03-29-2004, 07:25 AM
  3. OpenGl 2D Tiling problem
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 09-30-2002, 12:48 AM
  4. Problem running a Cboard C++ tutorial!
    By Monkey Liar in forum C++ Programming
    Replies: 6
    Last Post: 02-15-2002, 03:32 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21