• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0

Setting up GLFW for MinGW CodeBlocks

4 posts in this topic

Well... I'm kinda new to this stuff... but can somebody help me figure out how to setup GLFW for CodeBlocks for Windows.... I have installed MinGW version of CodeBlocks... i tried to follow the release notes given in their sites, but i just don't get it... They have given how to compile using MinGW... Can anyone explain me the line (taken from the release notes of GLFW) which is given below:


GLFW can be compiled using only MinGW. Open a Windows command prompt, enter the root directory of the GLFW source distribution and use the win32-mingw target:

mingw32-make win32-mingw



Share this post

Link to post
Share on other sites

If you have MinGW installed, have it configured so that the MinGW/bin directory is part of the PATH, then you can open a Windows Command Prompt window, navigate to the root directory of wherever you unzipped the GLFW source, and type [b]mingw32-make win32-mingw[/b] and it should build the library.


mingw32-make is the MinGW version of [b]make[/b]. Make is a command-line tool (hence the need to open a command prompt window) that, when executed, will look for a file called Makefile in the executing directory. Makefile contains instructions for make, telling it how to build the project. A Makefile can specify certain [b]targets[/b] to build, allowing the library maintainer to provide different build paths for different build environments. The [b]win32-mingw[/b] target mentioned above, then, would instruct it to build the MinGW-specific path. Other build environments such as Linux would need to specify a different build target.


If all is set up correctly, executing the above instruction will result in a build. You should see a bunch of text spam in the command prompt window as files are compiled and libraries are linked. GLFW isn't huge, so it shouldn't take too long. If there are any errors, you'll need to note the error messages and try to figure out what went wrong. If it says that mingw32-make.exe is not a valid program, then you need to set up your PATH.


The PATH, of course, is the system environment variable telling Windows where to look when commands are executed at the command prompt. Go into your Control Panel, search for environment variables, and edit your system PATH, appending the path to your MinGW/bin directory. You'll probably have to restart your computer for the new PATH to be in effect.


Other errors might occur if there are missing dependencies in the project. I believe that GLFW includes any third-party dependencies, so you shouldn't have any problems there.


Once all is done, you will end up with some library files, usually a file called something like [b]libGLFW.a[/b] if it is a static build, or a .DLL if it is shared. These libraries may be found somewhere in the build tree; commonly, a folder called [b]lib[/b] but sometimes just dumped in the same folder as the source files. Link this library with your application to use GLFW.


Share this post

Link to post
Share on other sites

When building with Code::Blocks/MinGW, I usually just import the Visual Studio solution provided. It works most of the time and you don't have to cut through the command line jungle.


Share this post

Link to post
Share on other sites

Alright I figured it out...

To "anyone who had no idea how to sort out this stuff and reached here", you gotta do this for setting up GLFW:

1. Download the MinGW version of CodeBlocks and install it.
2. Download MinGW from is official site amd install in this directory:
3. Download GLFW from its official site [http://www.glfw.org/].
4. After downloading it extract it, lets say in Desktop...
5. Right click My Computer and select Properties.
6. Go to "Advanced System Settings".
7. In the box that appears, click "Environment Variables...".
8. In the box named "System Variables", search for "Path" or "PATH" under "Variable" column.
9. Double click it and then a box will appear.
10. In the "Variable" box, you will see directories of some installed stuff... Over here, you have to give your MinGW directory...
Type this: ";C:\MinGW\bin" (excluding quotes).
NOTE: Adding semicolon is mandatory as it separates from other directories given in that box.
Click OK, OK, and OK.
11. Open command prompt... Then type the following command:
C:\Users\yourcomputername> cd <the directory where you extracted GLFW>
For example, mine was like this:
C:\Users\PB9X> cd desktop\glfw-2.7.7
12. After you have typed that command, type the following command:
mingw32-make win32-mingw
Mine was like this:
C:\Users\PB9X\Desktop\glfw-2.7.7> mingw32-make win32-mingw
13. After typing that command, the compilation will take place.
14. After the compiling is over, go to the place where you have extracted glfw, and in that folder, you'll find a sub folder named "lib". In "lib" folder, open the folder named
15. Over here copy these files: libglfw.a, glfw.dll and libglfwdll.a to C:\Program Files (x86)\CodeBlocks\MinGW\lib
16. Copy glfw.dll to the system folder where opengl32.dll is located. It should be in C:\Windows\System32 (for 32 bit Windows) or C:\Windows\SysWOW64 (for 64 bit Windows). If opengl32.dll is located in both the directories, then do it for both of them. For me it was in both directories. So I copied to both of them. It won't create any problem.
17. Copy glfw.h from the "include" subfolder in the glfw folder you have extracted and paste it to C:\Program Files (x86)\CodeBlocks\MinGW\include\GL

Now the CodeBlocks part:

1. Open a new GLFW project and name the prject whatever you want and give the directory where you want to save your project. Then click Next.
2. Then it will ask you to select GLFW's location. Give this directory : C:\Program Files (x86)\Codeblocks\MinGW. Click Next and then click Finish.
3. In the "Management" area (it should be in the left side), collapse the folder named "Sources" and open main.cpp and run it.
4. Enjoy.... And start writing your GLFW programs... smile.png

Edited by parthibbiswas93

Share this post

Link to post
Share on other sites

Good of you to document it in detail, for future googling from others.


[quote name='parthibbiswas93' timestamp='1356616080' post='5014689']
15. Over here copy these files: libglfw.a, glfw.dll and libglfwdll.a to C:\Program Files (x86)\CodeBlocks\MinGW\lib

Notice that libglfw.a is for statically linked libraries, and libglfwdll.a is for dynamcally linked.


If you distribute your application someday, you will need to include glfw.dll if you use dynamical linkage. I used static linkage of glfw, to make it easier for me.


Microsoft strongly recommends using dynamic linkage. The performance cost is negligible, and the idea is that dll:s can be updated separately. However, with a library compiled by you, it is probably never going to be updated separately.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0