歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Objective-C調用C++文件

Objective-C調用C++文件

日期:2017/3/1 9:59:17   编辑:Linux編程

參考文章: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)

折騰半天的問題到此終於解決。

Copyright © Linux教程網 All Rights Reserved