SFML community forums
Help => General => Topic started by: rush905 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 (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.
-
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. ;)
-
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.