 |
Department of Engineering |
 |
 |
Installing C++ graphics libraries
C++ doesn't have any support for graphics, but some C++ coursework uses graphics, so if you want to do coursework at home without logging into CUED you'll need to install graphics libraries as well as a compiler. Here's a list of
courses and related libraries
- 1A C++ - openGL, GLUT, GLUI, GLUE
- 1A C++ Vacation Exercise - openGL, GLUT
- IIA Software Project - openGL, wxWidgets
Some of these libraries (openGL for example) might already be
installed on your machine, but to compile programs that use them you'll
need more than just the libraries - you'll need include files, etc (sometimes called a "development kit"). Here are some installation instructions - note that
the list is currently incomplete.
- Windows: (by Dr Gabor Csanyi).
To compile a GLUT graphics program with Cygwin first make sure you have installed cygwin's "opengl" option then try something like
g++ -O3 -o myprog myprog.cc -lglut32 -lglu32 -lopengl32
If instead you're using Visual Studio then download glut-3.7.6-bin.zip from http://www.xmission.com/~nate/glut.html. Unzip
the
zip archive and copy three files to your hard disk as follows:
- glut32.dll copy to C:\WINDOWS\system32
- glut.h copy to C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
- glut32.lib copy to C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
- MacOS: To use extra libraries with g++ (e.g. the GLUT library for graphics) first type
sudo ln -s /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/GLUT.framework /System/Library/Frameworks/GLUT.framework
(you only need to do this once) then
you can try the -framework option. E.g. you can compile a program called prog.cc that uses GLUT and openGL graphics by typing
g++ -framework GLUT -framework OpenGL -o prog prog.cc
If you're using Xcode
- Select Project->Add Frameworks, adding the GLUT and OpenGL frameworks.
- You'll have a file called main.cpp. If you replace the contents by the first example on our Using GLUT page, changing the #include <glut.h> line to #include <GLUT/glut.h>, you'll be able to Build and Run the program
- Linux: GLUT support is usually installed by
default. Different styles of linux have their own installation tools for adding
further packages. For Ubuntu, see their Installing Software page.
 |
 |