我在可可项目中包含 .mm 文件时遇到问题。.mm 文件#includes .cpp 文件。如果我不#import 项目构建良好。但是,我需要#import .mm 文件,但是当我这样做时,我找不到“字符串”文件。如何使用 mm 文件而不出现该错误?
问问题
132 次
2 回答
1
不要将#import 与 .mm 文件一起使用。将其公共接口移动到 .h 文件中,然后将其导入您需要的位置。
于 2012-11-15T22:48:14.310 回答
0
原来我需要将定义 cpp ivar 的接口部分移动到实现文件 CPPWrapper.mm
@interface CPPWrapper ()
@property (nonatomic, readwrite, assign) Cpp *cpp;
@end
@implementation CPPWrapper
@synthesize cpp = _cpp;
//do stuff with cpp ivar here
@end
于 2012-11-15T23:02:10.503 回答