# GLFW will not link to my project

**URL:** <https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645>\
**Category:** support\
**Created:** [May 30, 2024, 11:33pm UTC](https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645 "2024-05-30T23:33:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![UhGoomba](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/uhgoomba/32/920_2.png) [@UhGoomba](https://discourse.glfw.org/u/UhGoomba)\
**Post date:** [May 30, 2024, 11:33pm UTC](https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645/1 "2024-05-30T23:33:31Z")

</div>

I’m trying to compile glfw as a static lib during my premake build process, but when I link it to my project and try to call a function, I get of ton of linking errors (I think related to platforms). I’ve been banging my head at this for days. I wrote a premake5.lua file partially from resources online, and partially from the GLFW cmake file. I am using mingw64. I’ll post my [errors](https://www.codebin.cc/code/clwtw58cn0001l6089mu07k4e:3dyFKZ7mNewvjdRWGydNhJMvPgaunQ4VhxZpKwdCBSQS) and [premake5](https://www.codebin.cc/code/clwtvalfs0001l508so0iaiqz:4GJ6YmFDcv4tURWYXX37waWPPzKZhAVXgPquc5Zn94ZG) file.  
I really appreciate any help.

---

<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 31, 2024, 1:17pm UTC](https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645/2 "2024-05-31T13:17:58Z")

</div>

Hi @UhGoomba,

Welcome to the GLFW forum.

Creating your own `premake5` file is a bit tricky, especially as you will need to create a [glfw\_config.h](https://www.glfw.org/docs/3.3/compile.html#compile_manual) file yourself or set up the required macros as described in the docs.

What I would do is run CMake to generate your build files, and then base your `premake5` setup on that.

I don’t know `premake5` but it looks like you are missing a number of required source files in the `files` section. If you look at the errors you can see the functions which are not included being listed. For example if you search for [\_glfwPlatformFreeModule](https://github.com/search?q=repo%3Aglfw%2Fglfw%20_glfwPlatformFreeModule&type=code) you will find that it is defined in a number of files each of which has the name of the platform.

For instance `_glfwPlatformFreeModule` is defined in `win32_module.c` for the Windows platform which MinGW-w64 targets. You will need all the win32\_\* files in your `premake5` file.

---

<div class="post-metadata">

**Author:** ![UhGoomba](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/uhgoomba/32/920_2.png) [@UhGoomba](https://discourse.glfw.org/u/UhGoomba)\
**Post date:** [May 31, 2024, 7:16pm UTC](https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645/3 "2024-05-31T19:16:29Z")

</div>

Is the win32 stuff not only for 64 bit? Am I misinterpreting this? I assumed the win32 variable in the cmake file was if you were using 32 bit or not

---

<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 31, 2024, 7:39pm UTC](https://discourse.glfw.org/t/glfw-will-not-link-to-my-project/2645/4 "2024-05-31T19:39:45Z")

</div>

win32 just means Windows OS. it’s a common code abbreviation.
