可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
So I tried to import aurioTouch into my app and I keep getting this error saying
"unknown type name 'class' did you mean "Class"?
My bridging header file:
#import "AudioController.h" #import "BufferManager.h" #import "FFTHelper.h" #import "DCRejectionFilter.h"
I tried changing this to .mm for all these files but it doesn't solve my issue. Anyone have any ideas why this is happening?
回答1:
To mix C++ and Objective-C you need to use the .mm extension. If, however, your class is only C++ (and only includes C/C++ headers) then you can use the normal .cpp extension.
.mm A source file with this extension can contain C++ code in addition to Objective-C and C code. This extension should be used only if you actually refer to C++ classes or features from your Objective-C code.
回答2:
I had the same issue, and I could solve by the following answer: Import aurioTouch Library with Swift
In short, AudioController.h
is not an Obj-C file because it imports C++ files (BufferManager.h, FFTHelper.h, and DCRejectionFilter.h). So you cannot bridge it to Swift just like that.
You have to create a pure Obj-C file wrapping AudioController.h
.