未知类型名称'class';你是说“班级”吗? [英] Unknown type name 'class'; did you mean 'Class'?

查看:690
本文介绍了未知类型名称'class';你是说“班级”吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实现AQRecorder.h类从SpeakHere Apple Xcode项目示例,但即使我重命名我的实现类为ext。 *。mm 并放置 #importAQRecorder.h仍然会收到错误未知的类型名称'类';你的意思是'类'?和许多其他。
根据我的意思是它不被识别为C ++类。



任何帮助将不胜感激。

解决方案

我刚刚有这个确切的问题。我有一个视图控制器使用AQRecorder.mm的AQRecorder类。



当我在我的视图控制器中包含AQRecorder.h时,发生了这些错误。它似乎对我,因为我的直目标c视图控制器(命名为.m文件)包括C + +头文件,编译器抛出的虚假错误。



有两种解决方案。最快的是重命名视图控制器类,包括AQRecorder.h为.mm文件,在我的情况下,UIRecorderViewController从.m到.mm。



以下包括:

  #includeCAStreamBasicDescription.h
#includeCAXException.h

从AQRecorder.h中移至AQRecorder.mm。这意味着直接的C ++样式的头文件将不再包含在你的简单的Obj-C源代码中(通过引用)。



希望有帮助,有意义。 p>

I'm trying to implement AQRecorder.h class from SpeakHere Apple Xcode project example, but even I rename my implementation class to ext. *.mm and put line with #import "AQRecorder.h" still getting error "Unknown type name 'class'; did you mean 'Class'?" and many others. Which according to me means that it is not recognized as C++ class.

Any help will be appreciated.

解决方案

I've just had this exact problem. I had a view controller using the AQRecorder class from AQRecorder.mm.

When I included AQRecorder.h in my view controller these errors occurred. It appeared to me because my straight objective-c view controller (named as a .m file) was including C++ header files the compiler was throwing spurious errors.

There are two solutions. The quickest is to rename the view controller class including AQRecorder.h to be a .mm file, in my case UIRecorderViewController from .m to .mm.

Or, move the following includes:

#include "CAStreamBasicDescription.h"
#include "CAXException.h"

Out of AQRecorder.h into AQRecorder.mm. This means that straight C++ style header files will no longer be included (by reference) in your plain Obj-C source.

Hope that helps, and makes sense.

这篇关于未知类型名称'class';你是说“班级”吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆