unknown type name virtual when using c++ in Xcode 4.2.1
unknown type name virtual when using c++ in Xcode 4.2.1
- Subject: unknown type name virtual when using c++ in Xcode 4.2.1
- From: stevens <email@hidden>
- Date: Fri, 10 Feb 2012 20:15:05 +0800
I had read a book named "iPhone 3D programming" ,it used a c++ sample code
#include <stdlib.h>
#ifndef HelloArrow_IRenderingEngine_hpp
#define HelloArrow_IRenderingEngine_hpp
enum DeviceOrientation
{
DeviceOrientationUnknown,
DeviceOrientationPortrait,
DeviceOrientationPortraitUpsideDown,
DeviceOrientationLandscapeLeft,
DeviceOrientationLandscapeRight,
DeviceOrientationFaceUp,
DeviceOrientationFaceDown
};
//Creates an instance of the renderer and sets up various OpenGL state.
struct IRenderingEngine * CreateRender1();
//Interface to the OpenGL ES renderer;consumed by GLView.
struct IRenderingEngine
{
virtual void Initialize(int width,int height)=0;
virtual void Render() const=0;
virtual void UpdateAnimation(float timeStep)=0;
virtual void OnRotate(DeviceOrientation newOrientaion)=0;
virtual ~IRenderingEngine(){}
};
#endif
When I compiled this code in Xcode 4.2.1(OS X Lion 10.7.3),it reported that IRenderingEngine.hpp: error: unknown type name 'virtual' .
I had created a empty application project which included this sample code.And I had renamed all *.m file into *.mm.For example,renamed AppDelegate.m into AppDelegate.mm, renamed GLView.m into GLView.mm,but remain *.hpp file and *.cpp file.But it doesn't work for me.Any suggestions will be appreciated.
stevens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden