C++ 和 Object-c 混编时 提示的 class 错误

来源:互联网 发布:mac刷新桌面 编辑:程序博客网 时间:2024/06/16 03:38

http://stackoverflow.com/questions/8588734/unknown-type-name-class-did-you-mean-class

Unknown type name 'class'; did you mean 'Class'?


  1. Select "Compile Source As" variable in compiler settings and set its value to "Objective-C++" i.e Build Settings->Apple LLVM 7.0 - Language->Compile Source As->Objective-C++ (in Xcode 7.1)

  2. Change the relevant files which include a C++ header file from .m to .mm (sometimes you need to change all .m to .mm). 

  3. If you face incompatible type errors, explicitly do type casting of the required type. These errors might not have shown up when it was .m file.


0 0
原创粉丝点击