Visual Studio 2013 a mystery

kl1str0n wrote on Wednesday, December 24, 2014:

I am trying to follow the tutorial at http://www.glfw.org/docs/latest/quick.html but cannot get the glfw functions to link

I tried the steps in the other post for Visual Studio 2013 on this subject involving cmake. The steps are:

  1. Downloaded cmake
  2. Ran the GUI cmake (cmake-gui).
  3. Set the source code to be the glfw directory.
  4. Set the build directory to be a directory called glfw_build. This can be anywhere, but I placed it adjacent but not within glfw
  5. Clicked configure. Selected the generator Visual Studio 12 (as VS 2013 is version 12 of the compiler toolchain).
  6. Clicked generate.
  7. Opened the project file in the glfw_build dir.

This series of steps does not seem to yield a usable and functioning library of tools and dll’s for windows or Visual Studio 2013.

For C/C++ compiler I expect an include directory with *.lib files including glfw3.h and glfwnative.h

For linker I expect a to have to add under additional library directories a directory with glfw3.dll, glfw3.lib, and glfw3dll.lib

For linker I also expect to have to put the following under input: opengl32.lib;glfw3.lib

I have done this but every glfw function, beginning with glfwDestroyWindow, fails link with error lnk2028 as an unidentified token.

Where are my assumptions wrong and how can I get glfw to work under visual studio 2013?

kl1str0n wrote on Wednesday, December 24, 2014:

OK so I solved this myself.

First I set my project to actually build 64 bit code. In the Properties section I selected Active(x64)

Then I modified the value of Common Language Runtime Support option selected from /Clr to No Common Runtime Support

I also had a calling convention setting of __cdecl /(Gd), which I changed to __stdcall(/Gz)

After these changes, apparently, the tutorial worked.

I still don’t understand what using cmake does with regard to generating required glfw files. The source code that is downloaded does not seem to have the code required to build the *.lib files or *.dll, which is what I was trying to do to get my tutorial to work.

But I will start a different thread for that.

matt2115 wrote on Wednesday, December 24, 2014:

Dave,

I’m trying to link in glfw3.lib into my VS2013/64 project. I’m getting these two link errors
1>glfw3.lib(init.obj) : error LNK2019: unresolved external symbol __imp_vsnprintf referenced in function _glfwInputError
1>glfw3.lib(monitor.obj) : error LNK2019: unresolved external symbol __imp__strdup referenced in function _glfwCreateMonitor

I’ve found that VS2013 likes all libs to be compiled for debug if the project is. It doesn’t like it mixed with release and debug libs. VS2008 didn’t seem to care.

Do you think I should build a debug glfw3.lib? I tried your solution above and still got the same link errors.

Thanks,
Matt