# 1 unresolved externals

**URL:** https://discourse.glfw.org/t/1-unresolved-externals/1847
**Category:** support
**Created:** [April 30, 2021, 12:48pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847 "2021-04-30T12:48:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![RunKittenzRComing](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@RunKittenzRComing](https://discourse.glfw.org/u/RunKittenzRComing)
#### Post date: [April 30, 2021, 12:49pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/1 "2021-04-30T12:49:00Z")

</div>

unresolved external symbol \_\_imp\_glClear referenced in function main  
1 unresolved externals

Trying to set up 64x GLFW, had the 11 unresolved errors but fixed it. I’m on VS 2019. Here’s what I’ve done so far:

Changed Config\>Linker\>General\>Additional Library Directories to lib.  
Added glfw3dll.lib and glfw3.lib to Config\>Linker\>Input\>Additional Dependencies  
Changed Config\>General\>C/C++\>Additional Include Directories to include.

Not sure where I went wrong, tried looking up the error to no avail

---

<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: [April 30, 2021, 1:06pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/2 "2021-04-30T13:06:04Z")

</div>

glClear is an OpenGL function, which on windows requires you to link to opengl32.lib by adding it to your `Linker->Input->Additional Dependencies`. It’s a system library so you don’t need to add any include directories.

For GLFW you should **ONLY** link either glfw3.lib or glfw3dll.lib depending on whether you want the static or dynamic library, see [GLFW: Building applications](https://www.glfw.org/docs/latest/build_guide.html#build_link_win32).

---

<div class="post-metadata">

### Author: ![RunKittenzRComing](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@RunKittenzRComing](https://discourse.glfw.org/u/RunKittenzRComing)
#### Post date: [April 30, 2021, 1:15pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/3 "2021-04-30T13:15:32Z")

</div>

Okay, now it opens the window and loads everything but it gives the error “The code execution cannot proceed because glfw3.dll was not found. Reinstalling the program may fix this 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: [April 30, 2021, 1:39pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/4 "2021-04-30T13:39:24Z")

</div>

If you are dynamically linking the dll with `glfw3dll.lib` then you need to put place the dll somewhere the system will find it. My recommendation is to place it in the same folder as your executable is output to.

---

<div class="post-metadata">

### Author: ![RunKittenzRComing](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@RunKittenzRComing](https://discourse.glfw.org/u/RunKittenzRComing)
#### Post date: [April 30, 2021, 10:08pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/5 "2021-04-30T22:08:27Z")

</div>

What’s the difference between static and dynamic out of curiosity?

---

<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: [May 1, 2021, 12:03pm UTC](https://discourse.glfw.org/t/1-unresolved-externals/1847/6 "2021-05-01T12:03:35Z")

</div>

In static linking the linker (which runs after the compiler) adds the object file which contains the compiled code to your executable.

In dynamic linking the linker doesn’t add the code to your executable, but adds data to ensure that when the program is run the correct library (.dll for Windows, .so for Linux etc.) is loaded at run time. There are further details, but this covers the basics.

It is thus possible to change a dynamically linked library without modifying the executable. This allows bugs to be fixed in system libraries without changing any installed executables. Games on PCs often put game specific logic into a dll which can then be modified by end users - i.e. code mods.

Since GLFW is fairly small, using a statically linked library is usually the best approach.

There’s a good introduction to linkers here:  
[https://www.lurklurk.org/linkers/linkers.html](https://www.lurklurk.org/linkers/linkers.html)
