# Error compiling glfw

**URL:** <https://discourse.glfw.org/t/error-compiling-glfw/1856>\
**Category:** support\
**Created:** [May 15, 2021, 4:28am UTC](https://discourse.glfw.org/t/error-compiling-glfw/1856 "2021-05-15T04:28:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxidk82xx](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/xxidk82xx/32/516_2.png) [@xxidk82xx](https://discourse.glfw.org/u/xxidk82xx)\
**Post date:** [May 15, 2021, 4:28am UTC](https://discourse.glfw.org/t/error-compiling-glfw/1856/1 "2021-05-15T04:28:09Z")

</div>

ive been trying to understand how to compile glfw and I am unable to figure out what to do i can only post one screenshot for some reason but this screenshot shows the errors and file locations

 ![Screenshot (17)](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/98a5f5b8b779881b07bcd4308d9678c1d271854a.png)

my tasks file looks like

// See [https://go.microsoft.com/fwlink/?LinkId=733558](https://go.microsoft.com/fwlink/?LinkId=733558)

```
// for the documentation about the tasks.json format

"version": "2.0.0",

"tasks": [

    {

        "label": "build",

        "type": "shell",

        "command": "g++",

        "args": 

        [

            "-o",

            "test",

            "-g",

            "2d render.cpp"

        ],

        "group": 

        {

            "kind": "build",

            "isDefault": true

        }

    }

]

```

}  
im using mingw g++ to compile my code

---

<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 15, 2021, 1:38pm UTC](https://discourse.glfw.org/t/error-compiling-glfw/1856/2 "2021-05-15T13:38:55Z")

</div>

Hi @xxidk82xx,

Welcome to the GLFW forum!

See [my reply here to another post on compiling with MinGW](https://discourse.glfw.org/t/glfw-doesnt-seem-to-be-linking-properly-with-mingw-w64/1854/2).

In short you need to link with the glfw3 library, and since you are using OpenGL you also need to link against opengl32.lib, you may also need to link against other Windows libraries explicitly as per [the GLFW documentation](https://www.glfw.org/docs/latest/build_guide.html#build_link_win32).

To [link a library with g++ this guide might be helpful](https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html#zz-1.8).
