1

I'm trying to setup glfw with MSVS 2012.

I downloaded the latest version of glfw from http://www.glfw.org/download.html (32 bit). In the next step i created a new property sheet with the following content:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>$(glfw_DIR)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <AdditionalLibraryDirectories>$(glfw_DIR)\lib-msvc120;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

Then I tried to run the following code:

#include <GLFW/glfw3.h>
#include <thread>

int main()
{
    glfwInit();
    std::this_thread::sleep_for(std::chrono::seconds(1));
    glfwTerminate();
}

and received the following Output:

1>------ Erstellen gestartet: Projekt: openGL_Basic_flow, Konfiguration: Debug Win32 ------
1>LINK : warning LNK4098: Standardbibliothek "MSVCRT" steht in Konflikt mit anderen Bibliotheken; /NODEFAULTLIB:Bibliothek verwenden.
1>glfw3.lib(window.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__glClear@4" in Funktion "_glfwCreateWindow".
1>glfw3.lib(context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__glGetIntegerv@8" in Funktion "__glfwRefreshContextAttribs".
1>glfw3.lib(context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__glGetString@4" in Funktion "_glfwExtensionSupported".
1>glfw3.lib(wgl_context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__wglCreateContext@4" in Funktion "__glfwCreateContext".
1>glfw3.lib(wgl_context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__wglDeleteContext@4" in Funktion "__glfwDestroyContext".
1>glfw3.lib(wgl_context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__wglGetProcAddress@4" in Funktion "__glfwPlatformGetProcAddress".
1>glfw3.lib(wgl_context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__wglMakeCurrent@8" in Funktion "__glfwPlatformMakeContextCurrent".
1>glfw3.lib(wgl_context.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__wglShareLists@8" in Funktion "__glfwCreateContext".
1>glfw3.lib(win32_time.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__dtoul3" in Funktion "__glfwPlatformSetTime".
1>glfw3.lib(win32_time.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__ultod3" in Funktion "__glfwInitTimer".
1>C:\Projektmappe\Debug\openGL_Basic_flow.exe : fatal error LNK1120: 10 nicht aufgelöste Externe
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========

I also tried to fix it with the workaround mentioned here: Compiling GLFW with Visual Studio 2012 But it didn't help. The output changed to the following:

1>------ Erstellen gestartet: Projekt: openGL_Basic_flow, Konfiguration: Debug Win32 ------
1>  main.cpp
1>LINK : warning LNK4098: Standardbibliothek "MSVCRT" steht in Konflikt mit anderen Bibliotheken; /NODEFAULTLIB:Bibliothek verwenden.
1>glfw3.lib(win32_time.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__dtoul3" in Funktion "__glfwPlatformSetTime".
1>glfw3.lib(win32_time.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__ultod3" in Funktion "__glfwInitTimer".
1>C:\Projektmappe\Debug\openGL_Basic_flow.exe : fatal error LNK1120: 2 nicht aufgelöste Externe
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========

Any other ideas?

Community
  • 1
  • 1
Benedikt Bock
  • 1,007
  • 15
  • 37
  • 1
    Make sure you use binaries for your exact compiler version. Meaning use the ones in the `lib-msvc110` folder and not the ones in the `lib-msvc120` folder. VC110 = Visual Studio 2012. VC120 = Visual Studio 2013. – drescherjm Jan 03 '15 at 15:52

1 Answers1

1

You are using the wrong binaries for Visual Studio 2012. The correct binaries are in the lib-msvc110 folder. You need to always be cautious when you have 2 or 3 digit versions since these do not match the year (well they do for 2010 only).

  • VC90 = Visual Studio 2008
  • VC100 = Visual Studio 2010
  • VC110 = Visual Studio 2012.
  • VC120 = Visual Studio 2013.
drescherjm
  • 10,365
  • 5
  • 44
  • 64