# Linking & Compiling GLFW with MinGW

**URL:** <https://discourse.glfw.org/t/linking-compiling-glfw-with-mingw/1969>\
**Category:** support\
**Created:** [December 27, 2021, 12:00am UTC](https://discourse.glfw.org/t/linking-compiling-glfw-with-mingw/1969 "2021-12-27T00:00:35Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [January 26, 2022, 8:47pm UTC](https://discourse.glfw.org/t/linking-compiling-glfw-with-mingw/1969/4 "2022-01-26T20:47:06Z")

</div>

With compilers like GCC you need to list files and libraries before the files and libraries they depend on. In the command-line above your source file is listed after the GLFW library and the system libraries. Since there is nothing listed after the source file that defines `glfwInit` the link fails.

Moving the source file before the libraries should fix this problem.

---

_[View the full topic](https://discourse.glfw.org/t/linking-compiling-glfw-with-mingw/1969)._
