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

Author Topic: Setting up OpenGL with Visual C++?  (Read 2706 times)

0 Members and 1 Guest are viewing this topic.

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Setting up OpenGL with Visual C++?
« on: August 21, 2012, 01:45:28 am »
Hi, I'm trying to set up OpenGL with Visual C++ on Windows 7. I'm trying to get this source from the tutorial to compile:

http://pastebin.com/dFrUj4zk

But I get this error:
Error   1   error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main   C:\Users\Nick\Desktop\Rendering\Rendering\Rendering.obj



I would imagine that I need to add some sort of OpenGL.lib file, but when I try and add "sfml/opengl-d.lib" to the "additional dependencies" category under Linker settings, I get an error that it doesn't exist.


I couldn't find anything about this under the tutorial, or anywhere online. So if anyone could please have the patience to help me out with this simple problem I would be extremely grateful.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10916
    • View Profile
    • development blog
    • Email
Re: Setting up OpenGL with Visual C++?
« Reply #1 on: August 21, 2012, 02:19:52 am »
Quote
You will then need to link your program to the OpenGL library. Unlike what it does with the headers, SFML can't provide a unified way of linking OpenGL. Therefore, you need to know which library to link to according to what OS you're using ("opengl32" on Windows, "GL" on Linux, etc.). Same thing for GLU, in case you use it too: "glu32" on Windows, "GLU" on Linux, etc.
I don't see anything about sfml/opengl-d.lib... ;)
Note OpenGL is not contained in SFML but it's installed on your PC. I think you just have to add opengl32 (as mentioned in the tutorial) to your linker settings and you're good. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Setting up OpenGL with Visual C++?
« Reply #2 on: August 21, 2012, 02:46:59 am »
Hey, it's you again!

Thank you for having patience with me again hahaha.

For anyone else looking at this in the future, I solved the problem by adding "opengl32.lib" under additional dependencies under the linker settings. That solved the problem for me.

 

anything