Hello all,
Ive been reading through the openGL superbible programming my own code as I go along (using C++/MCVS2008) I decided to Object orient everything for ease of use for myself instead of like the book kinda throwing everything under one file. Man did this [censored] MCVS off. I got all kinds of errors and I believe its becuase of my arrangement of #include statements in my sepearate files. Considering if you have just one file you put all your includes at the top and make sure any headers had #ifndef/#define/#endif thats pretty simple but ive got a strange heirachy now so its not so simple anymore. Well my question is abstractly whats the proper way to include headers when you have multiple files that include each other? Heres the details/example below. Im going to specify the files and whats in them.
glFrame.h
if you read the superbible you know this is one of Richard's
files to encapsulate a camera or object.
object.h //personal file
-Contains the definition of an object class
the object class contains a GLFrame object and other items.
object.cpp
-Contains the definition/initialization of the object class
window.h
-contains the definition/prototype of the functions for window.cpp, also contains some opengl types like GLFloat
window.cpp
contains win32 API main call and the callback procedure
Also contains an object class
now for the headers in each of these files im assuming it would have to be like this. (of course im assuming wrong so im looking for something to correct me)
object.h
#include <string>
#include "../../shared/glframe.h" // Frame Class
#include "../../shared/math3d.h"
#include <gl/gl.h>
#include <gl/glu.h>
object.cpp
#include <string>
#include "object.h"
window.h
#include <windows.h>
#include <gl/gl.h>
window.cpp
#include "window.h"
#include "object.h"
all my .h files have this structure
#ifndef NAMEOFHEADER
#define NAMEOFHEADER
...body...
#endif
Im getting errors like this
1>c:\users\jake\documents\visualstudioprograms\c++andopenglprograms\shared\glframe.h(207) : error C3861: 'glMultMatrixf': identifier not found
1>c:\users\jake\documents\visualstudioprograms\c++andopenglprograms\shared\glframe.h(211) : error C3861: 'glTranslatef': identifier not found
1>c:\users\jake\documents\visualstudioprograms\c++andopenglprograms\shared\glframe.h(234) : error C3861: 'glMultMatrixf': identifier not found
and this
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(1152) : error C2146: syntax error : missing ';' before identifier 'glAccum'
So what am I doing wrong here as far as my #include because im just not seeing it.
Thank you.