PIGE
    Home
    .plan
    FAQ
    .log
Compiling
    Linux/UNIX
    Mac OS 8 & 9
    Mac OS X
    Windows
Downloads
    Source Code
    Executable Demos
    Thesis
Screenshots
    Crate
    Room
Tutorials
    Collision Detection
    Creating Icons
    OpenAL
    A*
Resources
    OpenGL
    OpenAL
    Game Dev
    Books
Compiling : Windows with CodeWarrior

Adding OpenGL and Glut files

Note: These instructions were copied somewhere off the internet, however, I do not remember where, so I do not take any responsibility for the correctness of this solution. This has been made available since the previous link to compiling with Windows has disappeared.

Using OpenGL in Metroworks Codewarrior can be somewhat difficult at first, but once you have it setup right, it will work just fine. What you must do is be sure that all the required files are where they are supposed to be. Make sure you have downloaded all the required files, DLLs, and header files first. Several of the files are already built in and you will not have to change them, but to get Codewarrior to work you have to have the files in the following places:
  • Opengl32.lib in C:\..\Codewarrior\Win32-x86 Support\Libraries\Win32 SDK
  • Glu32.lib in C:\..\Codewarrior\Win32-x86 Support\Libraries\Win32 SDK
  • glut32.lib in C:\..\Codewarrior\Metroworks Standard Library\MSL C++\Bin
  • Opengl32.dll in C:\Windows\System
  • Glu32.dll in C:\Windows\System
  • glut32.dll in C:\Windows\System
  • glut.h in C:\..\Codewarrior\Metroworks Standard Library\MSL C++\Include
  • glu.h in C:\..\Codewarrior\Win32-x86 Support\Headers\Win32 SDK\gl
  • gl.h in C:\..\Codewarrior\Win32-x86 Support\Headers\Win32 SDK\gl
If the files are not in these exact locations it could still work, these locations work for me so I know them to be valid.

Once the files are in these locations, it is now a matter of integrating them into the compiler. Codewarrior will complain unless you put these files into the following locations:

The DLLs are fine were they are, you need not bother with them

The .lib files must be included in the project. To do this create a new project as a C++ console app. Then goto Add Files in the Project menu. This should give you a window and allow you to add files into your project. Now you must simply add the OpenGL32.dll, the Glu32.dll, and the glut32.dll. Once they appear in the project window, move them into the MSL ANSI Libraries folder. The project should now be ready to compile an OpenGL program. Note: for any new project that you create you will have to add these libraries into it.

The header files need simply be included in your .cpp file as a normal header file. Only include glut.h, it will do the rest.

Compile the code and it should work.

Creating a new OpenGL/OpenAL application with CodeWarrior

Note: These instructions refer to CodeWarrior Pro 5 on Windows XP. Different versions of CodeWarrior, operating system, or downloaded support files may result in some differences.
  1. File -> New
  2. Win32 C/C++ Application Stationary
  3. C Console App
  4. In the Win32 SDK Libraries folder, add these libraries: OpenGL32.lib, Glu32.lib, glut32.lib. These libraries can be found in this folder: C:\Program Files\Metrowerks\CodeWarrior\Win32-x86 Support\Libraries\Win32 SDK\. If you are also working with OpenAL, add ALut.lib and OpenAL32.lib. These two libraries are found at C:\Program Files\OpenAL 1.0 Software Development Kit\libs. Keep in mind that different versions of software may place files in different locations. If all else fails and you know that you should have the proper files somewhere on your computer, do a search to find the hiding files.
  5. Go to Target Settings. Then highlight the Access Paths menu.
  6. Add a new path: Win32-x86 Support\Headers\Win32 SDK. This directory hold the GL directory, which contains the gl.h, glu.h, glaux.h, and glut.h header files. If the GL directory is placed elsewhere, then the parent directory to the GL folder needs to be listed as an available path.

Other References

How to configure Visual C++ to work with GLUT
Other instructions for CodeWarrior 5 and 6 can be found here.

Simple and full instructions on compiling with OpenGL and CodeWarrior can be found at www.cs.csustan.edu/~rsc/NSF/. Download the simpleinstructions.pdf or fullinstructions.pdf.

If you feel the odd need to use Windows' APIs in your source code, you can check out this tutorial at Nehe. However, since PIGE is trying to stay away from such code, this is a discouraged practice.


Page created: 17. March 2003
Last modified: 9. December 2003