# GLFW configrations

**URL:** <https://discourse.glfw.org/t/glfw-configrations/1720>\
**Category:** support\
**Created:** [December 24, 2020, 2:23pm UTC](https://discourse.glfw.org/t/glfw-configrations/1720 "2020-12-24T14:23:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ab00amin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/ab00amin/32/444_2.png) [@ab00amin](https://discourse.glfw.org/u/ab00amin)\
**Post date:** [December 24, 2020, 2:23pm UTC](https://discourse.glfw.org/t/glfw-configrations/1720/1 "2020-12-24T14:23:33Z")

</div>

I have downloaded GLFW 3.3.2 for Windows 32 binaries  
I have wrote this code to generate empty window using C++ and visual studio

```cpp
#include <GLFW/glfw3.h>

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */
        glClear(GL_COLOR_BUFFER_BIT);

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

```

and when i build it gives me this error

Build started…  
1\>------ Build started: Project: Project1, Configuration: Debug Win32 ------  
1\>libglfw3.lib(init.c.obj) : error LNK2019: unresolved external symbol \_\_\_ms\_vsnprintf referenced in function \_\_glfwInputError  
1\>C:\amin\MyApplication\opengl\Project1\Debug\Project1.exe : fatal error LNK1120: 1 unresolved externals  
1\>Done building project “Project1.vcxproj” – FAILED.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [December 24, 2020, 6:44pm UTC](https://discourse.glfw.org/t/glfw-configrations/1720/2 "2020-12-24T18:44:47Z")

</div>

Hi @ab00amin,

Welcome to the GLFW forum!

Do check out the guide to [Building Applications with GLFW](https://www.glfw.org/docs/latest/build_guide.html#build_link_win32), paying particular attention the libraries you need to link to.

Additionally you may find that using this [GLFW starter project with CMake](https://github.com/juliettef/GLFW-CMake-starter) is an easier way to create the Visual Studio project you need.

Cheers,

Doug.

---

<div class="post-metadata">

**Author:** ![ab00amin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/ab00amin/32/444_2.png) [@ab00amin](https://discourse.glfw.org/u/ab00amin)\
**Post date:** [December 27, 2020, 8:09am UTC](https://discourse.glfw.org/t/glfw-configrations/1720/3 "2020-12-27T08:09:36Z")

</div>

yes I have checked it  
and aready linked these liberarys  
libglfw3.lib  
opengl32.lib  
User32.lib  
Gdi32.lib  
Shell32.lib  
legacy\_stdio\_definitions.lib

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [December 27, 2020, 4:00pm UTC](https://discourse.glfw.org/t/glfw-configrations/1720/4 "2020-12-27T16:00:50Z")

</div>

My recommendation would be to try the [GLFW starter project with CMake](https://github.com/juliettef/GLFW-CMake-starter).

I’m confused as to where you got `libglfw3.lib` from - did you build this yourself? The name of the Visual Studio pre-built libraries is `glfw3.lib` for static libraries and `glfw3dll.lib` for DLLs. These should be in a directory called lib-vc20XX where 20XX is the version of Visual Studio you are using - for example 2019. You can get these from here:

> **[GLFW - Download](https://www.glfw.org/download.html)**

If you want to create a project from scratch with Visual Studio, then a good approach would be to use the project wizard in Visual Studio to create a “Hello World” console application and then go from there - I have checked and this has the correct linker settings to work with vsnprintf at least with Visual Studio 2019. You shouldn’t need legacy\_stdio\_definitions.lib.

---

<div class="post-metadata">

**Author:** ![brianzuvich](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/brianzuvich/32/412_2.png) [@brianzuvich](https://discourse.glfw.org/u/brianzuvich)\
**Post date:** [December 30, 2020, 6:10pm UTC](https://discourse.glfw.org/t/glfw-configrations/1720/5 "2020-12-30T18:10:29Z")

</div>

Yeah this sounds like a misunderstanding of building and linking libraries and less about any confusion with GLFW. As an aside, “unresolved external symbol” and “unresolved externals” means that something went wrong in linking.

**Simplest way to do it is…**

1. Download the GLFW source.
2. Create a static library visual studio project with CMake.
3. Open the new project and compile the solution.
4. Grab the created libraries and include and link them in your project.

For a basic GLFW project on windows, all you should have to include is glfw3.lib and opengl32.lib.

_As an aside, your code looks to be correct, once you get the linking issue corrected._
