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

Author Topic: How do I "link your program to the OpenGL library"?  (Read 4175 times)

0 Members and 2 Guests are viewing this topic.

xzbobzx

  • Newbie
  • *
  • Posts: 26
    • View Profile
How do I "link your program to the OpenGL library"?
« on: May 20, 2013, 01:54:32 pm »
According to http://www.sfml-dev.org/tutorials/2.0/window-opengl.php, I need to link my program to the opengl32 library.

The what now?
How do I do this?

I'm getting these:
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
« Last Edit: May 20, 2013, 01:57:56 pm by xzbobzx »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: How do I "link your program to the OpenGL library"?
« Reply #1 on: May 20, 2013, 03:06:04 pm »
What have you done? Where are you stuck? What compiler do you use? What OS do you use? :)

If you don't know how to link libraries, you should definitely google a bit on this topic, since this is an essential subject in programming.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

xzbobzx

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I "link your program to the OpenGL library"?
« Reply #2 on: May 20, 2013, 03:48:39 pm »
Microsoft Visual Studio 2010 Express, windows, did everything setting up a regular SFML program.
I'm stuck at where I have to find the OpenGL libraries, it's all black pixie dust and magic for me.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: How do I "link your program to the OpenGL library"?
« Reply #3 on: May 20, 2013, 03:51:31 pm »
I'm stuck at where I have to find the OpenGL libraries, it's all black pixie dust and magic for me.
Are you sure you want to start with OpenGL then? Because understanding OpenGL is lot more complicated, than linking one library... ;)

In the project settings, where you've linked against SFML (i.e. where you wrote sfml-window.lib), you'll simply have to add opengl32.lib.
« Last Edit: May 20, 2013, 04:02:55 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How do I "link your program to the OpenGL library"?
« Reply #4 on: May 20, 2013, 04:00:52 pm »
Don't forget the .lib postfix.

But just to make it clear: You don't need to link OpenGL in order to use SFML. It is only necessary if you use OpenGL functions yourself. Which I don't recommend unless you know exactly what you do.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

xzbobzx

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How do I "link your program to the OpenGL library"?
« Reply #5 on: May 20, 2013, 04:08:48 pm »
Don't forget the .lib postfix.

But just to make it clear: You don't need to link OpenGL in order to use SFML. It is only necessary if you use OpenGL functions yourself. Which I don't recommend unless you know exactly what you do.

I know I don't need OpenGL for SFML, but I'd like to try my hand at OpenGL.


I'm stuck at where I have to find the OpenGL libraries, it's all black pixie dust and magic for me.
Are you sure you want to start with OpenGL then? Because understanding OpenGL is lot more complicated, than linking one library... ;)

In the project settings, where you've linked against SFML (i.e. where you wrote sfml-window.lib), you'll simply have to add opengl32.lib.

Thank you!
Works like a charm :D