问题描述:

I am using Visual Community for C++. I have tried to link GLFW to Visual Community. The steps I went through are follows:

  1. Link the include directories under VC++ directories.
  2. Link the library directories under VC++ directories.
  3. Add the .lib file in additional dependencies under linker>input

Visual Community recognises the header #include <GLFW/glfw3.h> and recognised glfwInit() but when glfwInit() is called it causes the build to fail. I get this build error:

LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

I then also get some unresolved externals:

Error LNK2019 unresolved external symbol __imp__vsnprintf referenced in function __glfwInputError

LNK2001 unresolved external symbol __imp__vsnprintf

LNK2019 unresolved external symbol __imp__sscanf referenced in function _parseVersionString

LNK2001 unresolved external symbol __imp___vsnprintf

LNK1120 3 unresolved externals

网友答案:

Sneaky... when I downloaded GLFW it had multiple lib folders (for the different releases) and only one include folder. I assumed that the include folder would work for all of the lib folders because there was only one. However that was not the case, the include folder only worked for the latest lib folder and I tried to use the 2013 GLFW instead of the latest 2015 GLFW lib folder with the include folder to no avail. I was using 2013 GLFW because that was the version the tutorial series I was watching used if you were wondering.

相关阅读:
Top