Archived

This topic is now archived and is closed to further replies.

JeroMiya

CodeWarrior, importing libraries

Recommended Posts

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: // brackets around include files are missing because // the file names won''t show up on the post #include gl.h // Header File For The OpenGL32 Library #include glu.h // Header File For The GLu32 Library #include glaux.h // 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 GL/gl.h Error : the file ''GL/gl.h'' cannot be opened GLAUX.H line 57 #include GL/gl.h Error : the file ''GL/glu.h'' cannot be opened GLAUX.H line 58 #include GL/glu.h There are those header files in the Win32 support folder in the headers folder. Also, when I try using #include gl\gl.h #include gl\glu.h #include gl\glaux.h What''s going on? why does my new project with the opengl libraries added not compile?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You need to make sure you have the right access paths setup. Here''s what I do in CW5 on the Mac, which I assume is relatively the same for CW5/6 on the PC. Go to the Edit menu and select the Target setttings option (It might have a different name if you''ve named your target something). Under the access paths option add the directory where your GL headers are. If you''re including them with angle brackets (#include ) you should add the path under system paths and if you''re using double quotes (#include "gl.h") add the path under user paths. Click save and it should work.

Share this post


Link to post
Share on other sites
You should add the directory containing the "gl" directory to your include search path. This directory should in turn contain the OpenGL headers. If you want you can also include the actual "gl" directory on your search path, if you want to be able to just write #include <gl.h> instead of #include <gl/gl.h> which seems to be the standard way of incuding the OpenGL headers.

BTW, to write the < and > symbols correctly write &gt; (gt == Greater Than) and &lt; (lt == Less Than) respectively.

Share this post


Link to post
Share on other sites
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 <gl/glut.h> to <glut.h>, <glu.h> <gl.h> (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.


Edited by - JeroMiya on August 4, 2001 12:55:47 AM

Share this post


Link to post
Share on other sites