OpenGL in devc++

This is a discussion on OpenGL in devc++ within the Game Programming forums, part of the General Programming Boards category; Hello. I am one litle newb that tryes to learn opengl! This, however is not easy when i get 21 ...

  1. #1
    Mipix
    Guest

    Question OpenGL in devc++

    Hello.
    I am one litle newb that tryes to learn opengl!

    This, however is not easy when i get 21 errors:

    [Linker error] undefined reference to `ChoosePixelFormat@8'
    [Linker error] undefined reference to `SetPixelFormat@12'
    [Linker error] undefined reference to `glViewport@16'
    [Linker error] undefined reference to `glMatrixMode@4'
    [Linker error] undefined reference to `glLoadIdentity@0'
    [Linker error] undefined reference to `gluPerspective@32'
    [Linker error] undefined reference to `glMatrixMode@4'
    [Linker error] undefined reference to `glLoadIdentity@0'
    [Linker error] undefined reference to `wglCreateContext@4'
    [Linker error] undefined reference to `wglMakeCurrent@8'
    [Linker error] undefined reference to `glClear@4'
    [Linker error] undefined reference to `glLoadIdentity@0'
    [Linker error] undefined reference to `gluLookAt@72'
    [Linker error] undefined reference to `glBegin@4'
    [Linker error] undefined reference to `glVertex3f@12'
    [Linker error] undefined reference to `glVertex3f@12'
    [Linker error] undefined reference to `glVertex3f@12'
    [Linker error] undefined reference to `glEnd@0'
    [Linker error] undefined reference to `SwapBuffers@4'
    [Linker error] undefined reference to `wglMakeCurrent@8'
    [Linker error] undefined reference to `wglDeleteContext@4'

    Does it have something to do with the folowing lines:
    "
    #pragma comment(lib, "libopengl32.lib")
    #pragma comment(lib, "libglu32.lib")
    "
    if it helps here are my path to the lib folder:
    "C:\Dev-Cpp\lib"

  2. #2
    Registered User Ace Bowers's Avatar
    Join Date
    Jul 2003
    Posts
    23
    Are you sure you included all the header files, those errors seem like they could be related to that. Then again, I'm a newbie also, so I could be wrong.
    "I have read about a hill in a book, so the hill must exist." -a Christian quote
    "I have not seen this hill, so it must not exist." -an Athiest quote
    "Well, I've heard of this hill, so lets bomb it." -a George Bush quote

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    That pragma relates to VC++...not devc++...link in those libs manually

  4. #4
    Mipix
    Guest

    Question

    How?

  5. #5
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    I'm a newbie and I had exactly the same problem some minutes ago while trying to compile the Open GL tutorial source code.

    I still have no clue why exactly this error occurs, but I found a way to get around it. I opened the OpenGL application template in Dev C++ and then pasted the tutorial source code again. It (almost) worked now.

    So it has to do something with the project settings. I checked this (Project/Project settings) and found this entry under the "Parameters" tab: -lopengl32

    Seems like some parameter to link a library. However there is no library called lopengl32, so I don't exactly understand it. Anyway. The number of error messages decreased a lot and only "glu..." errors remained so I "added" the glu32 library. Funny thing is, this lib gets added with full path and without the - in front of the parameter.

    Anyway, The tutorial compiled. No clue why or how, but it seems to work. I was just about to create a post about this because I'd like to understand why these options are needed. Maybe somebody could answer my question in this post. Seems to be on topic.

    Hope that helps.
    Last edited by darksaidin; 07-21-2003 at 01:15 PM.

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    1

    Talking thank you darksaidin

    Finaly i figured it out!
    You don't need these lines
    #pragma comment(lib, "libopengl32.lib")
    #pragma comment(lib, "libglu32.lib")
    because you should have them in the \project\project options\parameters rollout to get the project to work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM
  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