• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
unknown type name virtual when using c++ in Xcode 4.2.1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: unknown type name virtual when using c++ in Xcode 4.2.1
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Lion: Lock documents and custom undomanager
  • Next by Date: Re: NSReadPixel
  • Previous by thread: Re: NSReadPixel
  • Next by thread: Re: unknown type name virtual when using c++ in Xcode 4.2.1
  • Index(es):
    • Date
    • Thread