# Link error on KeyEventFunction

**URL:** <https://discourse.glfw.org/t/link-error-on-keyeventfunction/511>\
**Category:** support\
**Created:** [June 16, 2013, 2:41pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511 "2013-06-16T14:41:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 2:41pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/1 "2013-06-16T14:41:02Z")

</div>

**[sn1ckers](https://sourceforge.net/u/sn1ckers/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#c8b5):

I was running Horde3D and tried to run it with the latest glfw(3.0), and only include the dlls. And I got everything working except the KeyEvent where I got a link error.

Error 1 error LNK2019: unresolved external symbol “bool \_\_cdecl setupWindow(int,int,bool)” (?setupWindow@@YA\_NHH\_N@Z) referenced in function “void \_\_cdecl keyPressListener(struct GLFWwindow \*,int,int,int,int)” (?keyPressListener@@YAXPAUGLFWwindow@@HHHH@Z) F:\utveckling\gameLabb\ChicagoStandalone - Copy\main.obj ChicagoStandalone

The Horde3D example im running is Chicago. And if I remove the KeyEvent everything else works with mouse input and rendering. Any idea what might would be wrong?

I also tried to compile glfw to dlls but I cant figured it out, so I downloaded the glfw-3.0.bin.WIN32 and used the dlls and lib from that package. I also tried other version of the glfw.win32 packages but then a got alot more link errors.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 2:43pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/2 "2013-06-16T14:43:18Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#3622):

There are no functions with those names in GLFW. It’s an issue in Horde3D.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 4:55pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/3 "2013-06-16T16:55:50Z")

</div>

**[sn1ckers](https://sourceforge.net/u/sn1ckers/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#1226):

Sorry I should have provided more info. But it is from glfw I encounter the problem.

This is what i set up, and it is from the glfw3.h:

```
/*! @brief The function signature for keyboard key callbacks.
 *
 * This is the function signature for keyboard key callback functions.
 *
 * @param[in] window The window that received the event.
 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
 * @param[in] scancode The system-specific scancode of the key.
 * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT.
 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
 * held down.
 *
 * @sa glfwSetKeyCallback
 *
 * @ingroup input
 */
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);

```

and this is how i set it up:

```
glfwSetKeyCallback( window, keyPressListener );

static void keyPressListener(GLFWwindow* window, int key, int scancode, int action, int mods )

```

I got glfwSetCursorPosCallback( window, mouseMoveListener ); and glfwSetWindowCloseCallback( window, windowCloseListener ); to work with the same approach but not for glfwSetKeyCallback ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 5:15pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/4 "2013-06-16T17:15:26Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#ab8c):

The eror message says that you’re calling `setupWindow` but that the linker cannot find it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 6:00pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/5 "2013-06-16T18:00:38Z")

</div>

**[sn1ckers](https://sourceforge.net/u/sn1ckers/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#7ea8):

Thanks you very much 🙂 It was my own method that was wrong. So now I got it running. Im quite new to C++ so I don’t understand the link errors so well.

By the way do you know if there is a guide how to build dynamic libraries from C in visual studio? I searched but didn’t find any good straight on guide for a newbie as my self.

Thanks again.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [June 16, 2013, 6:05pm UTC](https://discourse.glfw.org/t/link-error-on-keyeventfunction/511/6 "2013-06-16T18:05:42Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Sunday, June 16, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/84353cf5/#e1a1):

There probably is one on MSDN.
