# Cannot get GFLW to work with VS2017 (LNK2001)

**URL:** <https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432>\
**Category:** support\
**Created:** [October 23, 2019, 12:09pm UTC](https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432 "2019-10-23T12:09:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mentor93](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mentor93/32/282_2.png) [@mentor93](https://discourse.glfw.org/u/mentor93)\
**Post date:** [October 23, 2019, 12:09pm UTC](https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432/1 "2019-10-23T12:09:09Z")

</div>

I’m learning OpenGL. Since many tutorials on the Internet use GFLW I’ve decided to use GFLW, too. I’ve downloaded binaries from the official website, extracted include files and lib files for VS2017 (I’m using VS2017). Set additional paths in my project settings, so IDE knows where to find includes and libs. I linked to opengl32.lib, glew32.lib and glfw3.lib. I set project configuration as x86 Debug (and made sure I put 32-bit libraries, not 64-bit) and set runtime library as /MTd. My project settings look fine, everything should be working, but I’m constantly getting many linker errors (mostly LNK2001):

```
1>glfw3.lib(win32_joystick.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(wgl_context.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(egl_context.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(osmesa_context.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(win32_monitor.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(monitor.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(vulkan.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(win32_window.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(init.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(window.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(input.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(win32_init.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ calloc
1>glfw3.lib(window.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __imp__ strncpy przywołany w funkcji _glfwWindowHintString
1>glfw3.lib(input.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ strncpy
1>glfw3.lib(win32_joystick.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ strncpy
1>glfw3.lib(input.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __imp__ strcspn przywołany w funkcji _glfwUpdateGamepadMappings
1>glfw3.lib(input.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __imp__ strspn przywołany w funkcji _glfwUpdateGamepadMappings
1>glfw3.lib(input.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __imp__ realloc przywołany w funkcji _glfwUpdateGamepadMappings
1>glfw3.lib(win32_monitor.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ realloc
1>glfw3.lib(monitor.obj) : error LNK2001: nierozpoznany symbol zewnętrzny __imp__ realloc
1>glfw3.lib(context.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __imp____ stdio_common_vsscanf przywołany w funkcji _sscanf
1>LIBCMTD.lib(exe_winmain.obj) : error LNK2019: nierozpoznany zewnętrzny symbol _WinMain@16 przywołany w funkcji "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>MSVCRT.lib(chandler4gs.obj) : error LNK2019: nierozpoznany zewnętrzny symbol __except_handler4_common przywołany w funkcji__ except_handler4

```

It’s in Polish, but “nierozpoznany zewnętrzny symbol” means “unrecognized external symbol”. It looks like there’s some problem with libs, but I don’t know what - I’m linking to glfw3.lib (32-bit, vs2017), I have my project set to debug and I set /MTd. I should be able to compile the project successfully. Tried many different configurations, libs for other Visual Studio versions, but nothing works - I always get some linker errors. Could someone help me?

---

<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:** [October 23, 2019, 1:04pm UTC](https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432/2 "2019-10-23T13:04:37Z")

</div>

It looks like you are missing some of the default windows libraries from your linker setting, such as `user32.lib` and `kernel32.lib`. By default Visual Studio projects noramlly link against the following libraries (not all are needed for a basic GLFW app though): `kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib`

---

<div class="post-metadata">

**Author:** ![mentor93](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mentor93/32/282_2.png) [@mentor93](https://discourse.glfw.org/u/mentor93)\
**Post date:** [October 23, 2019, 1:23pm UTC](https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432/3 "2019-10-23T13:23:19Z")

</div>

I’ve got them all - kernel32.lib, user32.lib and all the rest, so that cannot be a problem.

---

<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:** [October 23, 2019, 3:20pm UTC](https://discourse.glfw.org/t/cannot-get-gflw-to-work-with-vs2017-lnk2001/1432/4 "2019-10-23T15:20:54Z")

</div>

Did you also get a LNK4098 warning? If so you have the wrong runtime library. Since the binaries only ship with release builds I think you should try /MD as I believe this is what they are compiled against, if not try /MT.
