Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL undefined references  (Read 2770 times)

0 Members and 1 Guest are viewing this topic.

joske

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
OpenGL undefined references
« on: December 20, 2012, 06:18:47 pm »
Hi guys, I'm going through the tutorials of this site, and am currently trying to draw a cube ><
So, when I want to compile the program,


undefined reference to glClearDepth@8

pops up as an error, and the same goes with all the OpenGL functions.. Isn't OpenGL header contained in the window.hpp ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: OpenGL undefined references
« Reply #1 on: December 20, 2012, 06:22:26 pm »
Headers and libraries aren't the same thing. When you include OpenGL headers, the compiler knows that OpenGL functions exist. But then it doesn't tell the linker where to find them: for that you must link to the OpenGL library.
Laurent Gomila - SFML developer

joske

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: OpenGL undefined references
« Reply #2 on: December 20, 2012, 06:33:15 pm »
Yea, but I added the sfml-window and sfml-system library in the Project build options.. I do not get an error in the line where I use sf::Clock

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: OpenGL undefined references
« Reply #3 on: December 20, 2012, 07:01:51 pm »
The fact that SFML uses openGL doesn't mean that if you link SFML it will link OpenGL from beneath, as SFML is already compiled it doesn't need to, whereas you need to tell the linker where the OpenGL implementations are as they are not given anywhere else, which means that you have to link any OpenGL dependency you are using.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

joske

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: OpenGL undefined references
« Reply #4 on: December 20, 2012, 07:33:17 pm »
Added them , it works :) Thanks, hope I didn't bother you too much..