So I'm going through the first tutorial in O'Reilly's iPhone 3D Programming book. At this point in the tutorial, it pulls all the OpenGL ES stuff into a seperate c++ interface. I have followed the book to the letter, as far as I can tell, yet I can't seem to figure out this compiler error. I'm fairly new to C++ (mostly C# in the past), so I'm sure it's something stupid.
Below is the current state of all the relevant files.
I have a c++ header file called IRenderingEngine.hpp with the following contents:
enum DeviceOrientation {
Unknown,
Portrait,
PortraitUpsideDown,
LandscapeLeft,
LandscapeRight,
FaceUp,
FaceDown,
};
struct IRenderingEngine* CreateRenderer1();
struct IRenderingEngine {
virtual void Initialize(int width, int height) = 0; //Compiler error "expected specifier-qualifier-list before 'virtual'
virtual void Render() const = 0;
virtual void UpdateAnimation(float timeStep) = 0;
virtual void OnRotate(DeviceOrientation newOrientation) = 0;
virtual ~IRenderingEngine() {}
};
I have an objective-c/c++ header file called GLView.h that looks like this:
#import "IRenderingEngine.hpp"
#import <OpenGLES/EAGL.h>
#import <QuartzCore/QuartzCore.h>
@interface GLView : UIView {
EAGLContext* m_context;
IRenderingEngine* m_renderingEngine; //Compiler error: Expected specifier-qualifier-list before "IRenderingEngine"
float m_timeStamp;
}
- (void) drawView: (CADisplayLink*) displayLink;
- (void) didRotate: (NSNotification*) notification;
@end
And finally, a GLView.mm file with a barebones implementation:
#import "GLView.h"
@implementation GLView
+ (Class) layerClass
{
return [CAEAGLLayer class];
}
- (id)initWithFrame:(CGRect)frame {
return self;
}
- (void) drawView:(CADisplayLink *)displayLink
{
}
-(void) didRotate:(NSNotification *)notification
{
}
@end