GLUT Setup Tutorial with Eclipse CDT on Windows

Updated: March 6, 2007 By Paul Solt


One of my biggest frustrations with programming in a different Integrated Development Environment (IDE) or with a programming technology, is not knowing how to get started. There's generally a list of things which need to be done and sometimes it's hard to find solid tutorials on the internet. I created this tutorial to help bridge that gap. I've outlined and linked together the different steps necessary to get started with GLUT/OpenGL and Eclipse's CDT (C/C++ Development Tooling). I will also assume that the reader has some basic understanding of Eclipse, however I don't expect too much.

GLUT (Graphics Library Utility Toolkit) is an quick way to create OpenGL applications. It's cross platform so you can port anything you create in Windows to a different operating system. GLUT will take care of window management and input for your programs. OpenGL is a C based graphics library and it is state based, so you can think of it as a switchboard.

You can get the source file and executable for this tutorial here

Note: Read Max Berger's How To Guide for comprehensive coverage on steps 1, 2, and 3.

1. Download Eclipse SDK 3.2.2 or newer at

2. Install MinGW and the gcc/g++ compiler Compiler Setup

Eclipse CDT does not come with a compiler so you will have to install one. The easiest way is to use MinGW (Minimalist GNU for Windows) and the gcc/g++ compiler. The compiler comes with the necessary header and library files for programming with OpenGL, but you will need to add several GLUT files in step 4.

3. Install the C/C++ Development Tooling (CDT)

CDT is an environment which allows you to develop in C/C++ using Eclipse. It's relatively easy to download the plug-in from inside Eclipse.

     a. Go to Help -> Software Updates -> Find and Install

     b. Choose "Search for New Features to Install" and click on both "Callisto Discovery Site" and "The Eclipse Project Updates"

     c. Choose an "Update Site Mirror" and install any updates for Eclipse and then install "C and C++ Development" (CDT) from the Callisto Discovery site.

4. Download and setup GLUT

     a. Download GLUT MinGW

     b. Place glut32.dll in your C:\Windows\System32 folder

     c. Put glut.h in the folder C:\MinGW\include\GL folder and libglut32.a in C:\MinGW\lib (These folders are relative to where MinGW was installed).

5. Start a new C/C++ Project in Eclipse

     a. Go to File -> New -> Project, and choose "Managed Make C++ Project" from the wizard.

     b. Name the project and press Next -> Finish.

     c. After you finish creating the project you need to change the project settings to include the OpenGL and GLUT libraries. Highlight the new project and go to Project -> Properties.

     d. Choose "C/C++ Build" and select "Libraries" from under the "GCC C++ Linker" branch.

     You need to add glut32, glu32, and opengl32 to the list of libraries.

6. Create a simple GLUT C++ program

     a. Right click on the project name -> New -> Source File.

     b. Paste the code from Demo.cpp into the empty source file and save it. Eclipse will automatically compile the code and if everything was setup correctly you shouldn't see any compilation errors.

     NOTE: When you create programs using GLUT, you need to include windows.h and any standard library header before the glut.h header file.

     c. Run the program by right clicking on the Project Name -> Run As -> Run As Local C/C++ Application

     c. Now you have a basic GLUT OpenGL window which can be used to create 2D/3D applications.


Make sure that you include the glut32.dll with your program if you are going to redistribute it.

As of the writing of the tutorial Eclipse CDT did not support code formatting for C/C++, however it should be added in the future