CodeWarrior Pro 6 and OpenGL

Started by
1 comment, last by JeroMiya 22 years, 8 months ago
I stil can''t get CodeWarrior to compile an OpenGL program. When I create a new OpenGL program and go to "Add Files" to add the OpenGL libraries GLAUX.LIB, GLU32.LIB, and OPENGL32.LIB and then try to include from these libraries with: #include // Header File For The OpenGL32 Library #include // Header File For The GLu32 Library #include // Header File For The Glaux Library it gives me these errors: Error : the file ''GL/gl.h'' cannot be opened GLU.H line 22 #include Error : the file ''GL/gl.h'' cannot be opened GLAUX.H line 57 #include Error : the file ''GL/glu.h'' cannot be opened GLAUX.H line 58 #include There are those header files in the Win32 support folder in the headers folder. Also, when I try using #include #include #include What''s going on? why does my new project with the opengl libraries added not compile?
Advertisement
I found the solution. I''ll post it here for others who had my same problem.
This goes for most recent versions of codewarrior.
Step 1) Download the Win32 glut libraries, they are available at http://www.xmission.com/~nate/glut.html
Step 2) place a copy of glut.h into CodeWarrior/Win32-x86 Support/Headers/Win32 SDK/gl/
Step 3) Place a copy of glut32.lib in CodeWarrior/Win32-x86 Support/Libraries/Win32 SDK/
For a glut application:
Step 4) Create a new project in codeWarrior
Step 5) Select Win32 C++ console application and create the project
Step 6) Go to add files, and select glut32.lib that you just copied to your codewarrior folder.
For a non-glut application:
Step 4) Create a new project in codeWarrior
Step 5) Select Win32 GUI and create a project
---- then for both types
Step 6/7) Add glu32.lib, opengl32.lib, and maybe glaux.lib if you want to use glaux to your project.
Step 8) Copy glut32.dll into your project folder, not your project in codewarrior, just into the same folder as your executable will be
Step 9) Add your glut code to the project, remove the placeholder source file (hello32.cp or something similar)
Step 10) change your includes from to , (CodeWarrior automatically searches the entire Win32 SDK headers file for headers, you don''t need to specify that it''s in the gl folder when you compile with codewarrior. If you want portable code, then do something like:

#define COMPILE_FOR_CODEWARRIOR
// #define COMPILE_FOR_GCC


#ifndef COMPILE_FOR_GCC
#include gl/glut.h
...
#endif
#ifndef COMPILE_FOR_CODEWARRIOR
#include glut.h
...
#endif

Dont know if that actually works, but something like that.
There''s an alternative.
The behaviour of automatic recursive search of includes only works when the files are not prefixed with "somepath/to/include/glut.h". If a path like this one occurs in your sourcecode then you need to add the directory before the somepath directory to your include pathes.

In your case you need to add the path "CodeWarrior/Win32-x86 Support/Headers/Win32 SDK" to your acces pathes in the project preferences. This should do the trick

NextS

This topic is closed to new replies.

Advertisement