Using the WinBGIm Graphics Library with Dev-C++

September 2008

Description:

This page provides a mechinism for using the WinBGIm Graphics Library with the Dev-C++ development environment.. Additional documentation for the WinBGIm graphics library is available at www.cs.colorado.edu/~main/bgi.

Installation Notes:

  1. Install Dev-C++. I installed from the Version 4.9.9.2 Setup File.
  2. Download graphics.h to the include/ subdirectory of the Dev-C++ directories.
  3. Download libbgia. to the lib/ In order to use the WinBGIm subdirectory of the Dev-C++ directories.
  4. Whenever you #include <graphics.h> in a program, you must instruct the linker to link in certain libraries. The command to do so from Dev-C++ is Alt-P. Choose the Parameters tab from the pop-up window and type the following into the Linker area:
    -lbgi
    -lgdi32
    -lcomdlg32
    -luuid
    -loleaut32
    -lole32
    
    You can now compile and run programs that use the WinBGIm graphics library, such as this one that opens a small window, draws a circle and waits for the user to press a key:
    #include <graphics.h>
    
    int main( )
    {
        initwindow(400, 300, "First Sample");
        circle(100, 50, 40);
        while (!kbhit( ))
        {
            delay(200);
        }
        return 0;
    }
    

    Michael Main (main@colorado.edu)