參考文章:http://www.linuxidc.com/Linux/2013-03/82019.htm,但是發現同樣的方法在xcode 4.6已經不行了,實例化對象時會報:
“Receiver type for instance messages is a forward declaration”的錯誤。即使將"@class Hello;" 改為#import "Hello.h"也還是會在NewHello上報"Unkwon type class,did you mean Class" 的錯誤。
解決方法是:
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)
折騰半天的問題到此終於解決。