# How to link GLFW and glad with w64devkit

**URL:** <https://discourse.glfw.org/t/how-to-link-glfw-and-glad-with-w64devkit/2941>\
**Category:** support\
**Created:** [June 15, 2025, 12:02pm UTC](https://discourse.glfw.org/t/how-to-link-glfw-and-glad-with-w64devkit/2941 "2025-06-15T12:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bananakiller888](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@bananakiller888](https://discourse.glfw.org/u/bananakiller888)\
**Post date:** [June 15, 2025, 12:02pm UTC](https://discourse.glfw.org/t/how-to-link-glfw-and-glad-with-w64devkit/2941/1 "2025-06-15T12:02:05Z")

</div>

I spended too much time for linking GLFW and glad with w64devkit. I always getting errors like “undefined reference to Winmain” and other errors. I readed all documentation from the website and, I watched tutorials on YouTube and tryed to found information from other internet resources, but it still doesn’t work.

My project structure looks like this:  
project  
…include  
…GLFW  
…glfw3.h  
…glfw3native.h  
…glad  
…glad.h  
…KHR  
…khrplatform.h  
…lib  
…libglfw3.a  
…glad.c  
…main.c  
…Makefile

My Makefile looks like this:  
app.exe : glad.o main.o  
gcc glad.o main.o -lgdi32 -I include lib\libglfw3.a -o app.exe  
glad.o : glad.c  
gcc -c glad.c -lgdi32 -I include lib\libglfw3.a -o glad.o  
main.o : main.c  
gcc -c main.c -lgdi32 -I include lib\libglfw3.a -o main.o  
clear :  
rm \*.o app.exe

I tryed to switch w64devkit on Cygwin, Winlibs, MSYS2, TDM-GCC, but it still doesn’t work.

Sorry my english can be bad(I writed this topic without translator)  
Im newbie on GLFW forums

Thanks in advance for 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:** [June 15, 2025, 9:22pm UTC](https://discourse.glfw.org/t/how-to-link-glfw-and-glad-with-w64devkit/2941/2 "2025-06-15T21:22:02Z")

</div>

On Windows application can be “console” or “gui” depending on whether you want stdout/in connected to terminal by default or not. In gcc default application type is gui, thus it requires “WinMain” as entry point. “main” is used for console type applications. Either change entry point from “WinMain” to “main”, or change application to console with `-mconsole` argument if you want “main” entry point. All of this has nothing top do with glfw, that’s just how building C code for windows works.
