Setting Up GLFW3 in Visual Studio

Posted by sm81095 on Game Development See other posts from Game Development or by sm81095
Published on 2013-06-27T18:26:55Z Indexed on 2013/06/27 22:29 UTC
Read the original article Hit count: 1149

Filed under:
|
|
|

I decided a couple of days ago that I was going to start trying to develop games in C++ with OpenGL, instead of C# Monogame like I have been doing for a while. I was looking around for libraries to use, to make OpenGL a little easier to use. I settled on GLEW and GLFW. GLEW was a super easy copy/paste, but GLFW3 was not.

After looking around for a while and fighting with CMake, I got the GLFW2.lib file created, and I added the additional include directories, library directories, and linked my program to the glfw3.lib file I just created. The problem is, I get these linker errors when I try to run or build my program:

Error   1   error LNK2019: unresolved external symbol _glfwInit referenced in function _main    C:\Codex Interactive\Projects\OGLTest\OGLTest\test.obj  OGLTest
Error   2   error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main   C:\Codex Interactive\Projects\OGLTest\OGLTest\test.obj  OGLTest
Error   3   error LNK2019: unresolved external symbol _glfwSetErrorCallback referenced in function _main    C:\Codex Interactive\Projects\OGLTest\OGLTest\test.obj  OGLTest

and 10 other LNK2019 errors, all talking about some glfw method, as well as:

Error   14  error LNK1120: 13 unresolved externals  C:\Codex Interactive\Projects\OGLTest\Debug\OGLTest.exe 1   1   OGLTest

at the very bottom of the error list.

I've looked up most of these errors on their own, and the solutions that I find either do nothing to solve the problem, or are people commenting on how dumb people are for not being about to solve this linker problem. Any assistance to solve these errors would be greatly appreciated.

Info:

  • I built GLFW3 on Cmake for Visual Studio 11, 32 bit and 64 bit, and both threw the same errors.
  • The only extra libraries I linked were opengl32.lib, glu32.lib, and glfw3.lib
  • Here is the test code (from GLFW3's latest tutorial): Code

© Game Development or respective owner

Related posts about c++

Related posts about opengl