“Receiver type for instance messages is a forward declaration” in xcode 4.6

The problem is (as you’ve stated) file type for ViewController.m is Obj-C and Hello.h is a Obj-C++ file. The solution is to add

#import "Hello.h" 

to your ViewController.m file and change the file type of ViewController.m to Obj-C++ (from the right panel)


That basically means that you need to import the .h file containing the declaration of States.

However, there is a lot of other stuff wrong with your code.

  • You’re -init’ing an object without +alloc’ing it. That won’t work
  • You’re declaring an object as a non-pointer type, that won’t work either
  • You’re not calling [super init] in -init.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s