# Issues with installing pre-compiled GLFW libraries with code blocks

**URL:** <https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966>\
**Category:** support\
**Created:** [August 17, 2017, 7:01pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966 "2017-08-17T19:01:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 17, 2017, 7:01pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/1 "2017-08-17T19:01:43Z")

</div>

I’ve recently taken an interest in OpenGL rendering, but I can’t for the life of me seem to get the GLFW libraries to work. I’ve followed instructions on installing the pre-compiled libraries from videos such as

[https://www.youtube.com/watch?v=0WrSGMuU964](https://www.youtube.com/watch?v=0WrSGMuU964) and [https://www.youtube.com/watch?v=CBNoa3ZxUq4](https://www.youtube.com/watch?v=CBNoa3ZxUq4)

down to a tee, and spent countless hours scrutinizing over the details and trying to understand the happenings of compilers and linkers, but alas, I couldn’t fix my problem, so here I am seeking help. What am I doing wrong?

I downloaded the 32-bit windows binaries.  
I moved the “include” and “lib-mingw” folders into my project’s folder (Console Application).  
Under “Project \> Build Options \> Search Directories \> Compiler” I added the “include” directory as a relative path.  
Under “Project \> Build Options \> Search Directories \> Linker” I added the “lib-mingw” directory as a relative path.  
Under “Project \> Build Options \> Linker Settings” I added “glfw3”, “gdi32” and “opengl32” to the Link Libraries

Then when I try compiling the project with the sample code from the GLFW documentation, I receive the errors:  
cannot find -lglfw3  
Id returned 1 exit status

I find this more confusing yet, since there isn’t a “gdi32” nor “opengl32” in the “lib-mingw” folder, and there IS a glfw3 library file in it, yet that is the one it doesn’t manage to find. I’ve tried adding only the glfw3 library file in the lib-mingw folder to the “Link-Libraries” as a non-relative path, but that didn’t work either. Any ideas what I’ve done wrong here?

Thank you greatly in advance.  
~ Jeremy

---

<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:** [August 17, 2017, 9:54pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/2 "2017-08-17T21:54:57Z")

</div>

gdi32/opengl32 libraries come with mingw, so that’s why you don’t need them in glfw downloaded archive.

Can you see output of linker command in CodeBlocks? Does it have “-Lpath/to/lib-mingw” argument same as you set it?

---

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 18, 2017, 11:26am UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/3 "2017-08-18T11:26:38Z")

</div>

After taking a look at the build log, it seems it’s skipping over all of the libglfw.a files because it thinks they’re incompatible?  
[https://pastebin.com/fVA4EkLW](https://pastebin.com/fVA4EkLW)

And if I enter the direct path to the libglfw.a file non-relatively, it just doesn’t manage to read it.  
[https://pastebin.com/7kY4UzLV](https://pastebin.com/7kY4UzLV)

---

<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:** [August 18, 2017, 11:56am UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/4 "2017-08-18T11:56:26Z")

</div>

You are using a compiler that produces 64-bit binaries ( **x86\_64** -w64-mingw32-g++.exe) so you need to use 64-bit GLFW library files. These are in `lib-mingw-w64` in the 64-bit binary archive.

---

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 18, 2017, 12:11pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/5 "2017-08-18T12:11:45Z")

</div>

Ohh! I’ll test it out. Thank you!

---

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 18, 2017, 12:17pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/6 "2017-08-18T12:17:37Z")

</div>

What would the new linked libraries be for the 64-bit binaries instead of gdi32 and opengl32? I would have assumed gdi64 and opengl64, but apparently, they can’t be found.

gdi32 and opengl32 seem to be found, but I still get a bunch of errors:  
[https://pastebin.com/u6SxFmYq](https://pastebin.com/u6SxFmYq)

Build Log:  
[https://pastebin.com/MqSCwMCk](https://pastebin.com/MqSCwMCk)

---

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 18, 2017, 12:39pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/7 "2017-08-18T12:39:14Z")

</div>

I finally got it! glfw3 had to be linked before gdi32 and opengl3. Thanks for your help guys!

---

<div class="post-metadata">

**Author:** ![tombsar](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tombsar](https://discourse.glfw.org/u/tombsar)\
**Post date:** [August 18, 2017, 1:09pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/8 "2017-08-18T13:09:05Z")

</div>

Confusingly enough, the 64-bit versions of gdi32 and opengl32 don’t have different names. It’s similar to why Windows’ System32 folder contains 64-bit libraries, and SysWoW64 contains 32-bit…

---

<div class="post-metadata">

**Author:** ![Askyra](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@Askyra](https://discourse.glfw.org/u/Askyra)\
**Post date:** [August 18, 2017, 1:17pm UTC](https://discourse.glfw.org/t/issues-with-installing-pre-compiled-glfw-libraries-with-code-blocks/966/9 "2017-08-18T13:17:01Z")

</div>

Hmm, That’s true. I haven’t thought of it like that before.
