# Unresolved external symbol with static library VS2017

**URL:** https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064
**Category:** support
**Created:** [January 16, 2018, 6:04pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064 "2018-01-16T18:04:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anon74486996](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@anon74486996](https://discourse.glfw.org/u/anon74486996)
#### Post date: [January 16, 2018, 6:04pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/1 "2018-01-16T18:04:44Z")

</div>

Hello,

I’m starting to learn GLFW to use in C, I come from SDL where I know a lot of it and wanted to start doing OpenGL, so I wanted to try GLFW to learn something different from SDL.

Everything is good expect if I want to link the static one I got unresolved external symbol while compiling.

I tried with the one downloaded on the main website and compiling it myself but nothing to do for glfw3.lib.  
It only work only glfw3dll.lib

Anyone having this issue ?

I looked the function that are the problem and it look like it’s Windows’s one  
 ![](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b4b4c25d3b007584d3674f4bbadf622e18b8e156.png)

Config : I use Visual Studio 2017, I only link glfw3.lib, and I use glad (compiling the .c/.h on the project)

Thank’s

---

<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: [January 16, 2018, 6:21pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/2 "2018-01-16T18:21:22Z")

</div>

When building applications with the DLL you need to define GLFW\_DLL, which won’t work with the static library. See [http://www.glfw.org/docs/latest/build\_guide.html](http://www.glfw.org/docs/latest/build_guide.html)

Does this help?

---

<div class="post-metadata">

### Author: ![mmozeiko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mmozeiko/32/29_2.png) [@mmozeiko](https://discourse.glfw.org/u/mmozeiko)
#### Post date: [January 16, 2018, 6:32pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/3 "2018-01-16T18:32:48Z")

</div>

When liking with glfw static library you need to link to extra windows libraries. For example, gdi32.lib. To find out to which libraries you need to link, search for unresolved symbol in MSDN. For example, “GetClipboardData” is here: [https://msdn.microsoft.com/en-us/library/windows/desktop/ms649039.aspx](https://msdn.microsoft.com/en-us/library/windows/desktop/ms649039.aspx) At the bottom of page in table there is information about which library you need to use it, for this example it is “user32.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: [January 17, 2018, 10:49am UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/4 "2018-01-17T10:49:46Z")

</div>

@mmozeiko is correct, apologies for my rushed response.

If you create a new project in Visual Studio you should already have these libraries in your list of linker inputs.

---

<div class="post-metadata">

### Author: ![anon74486996](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@anon74486996](https://discourse.glfw.org/u/anon74486996)
#### Post date: [January 17, 2018, 2:54pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/5 "2018-01-17T14:54:30Z")

</div>

I Didn’t defined this but thank’s.

I think the problem is for the windows linking (because of the error log) but I didn’t found the lib needed. I’m gonna try this tonight.  
I create empty project when doing a new project so they are probably not linked.

Thank’s

---

<div class="post-metadata">

### Author: ![anon74486996](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@anon74486996](https://discourse.glfw.org/u/anon74486996)
#### Post date: [January 17, 2018, 9:49pm UTC](https://discourse.glfw.org/t/unresolved-external-symbol-with-static-library-vs2017/1064/6 "2018-01-17T21:49:21Z")

</div>

So I added  
User32.lib  
Gdi32.lib  
Shell32.lib  
And now it work 🙂

Thank’s, that’s strange no one had that before
