C ++从SpeakHere在iPhone应用程序 [英] C++ from SpeakHere in iPhone app

查看:155
本文介绍了C ++从SpeakHere在iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个模板应用程序,在那里我抓住了SpeakHere示例的记录部分,并删除了文件处理部分,但我努力让C ++部分的应用程序工作正常。一旦它进入C ++类,它会得到语法错误。如果我不导入头文件从C ++(当然不使用代码)到我的Objective C类,一切正常。我看不出我之间的区别,我的例子是做它。你能看到差别吗?

I've made a template app where I've grabbed the recording part of the SpeakHere example and removed the file handling part, but I'm struggeling to get the C++ part of the app working right. As soon as it enters the C++ class, it gets syntax errors. If I don't import the header files from C++ (and then of course don't use the code) into my Objective C classes, all works fine. I cannot see the difference between how I'm doing it and the example is doing it. Can you see the difference?

我已经把整个代码放在这里: http://github.com/niklassaers/testFFT

I've posted the entire code here: http://github.com/niklassaers/testFFT

我遇到的构建错误是:

testFFT/CAStreamBasicDescription.h:91:0 testFFT/CAStreamBasicDescription.h:91: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CAStreamBasicDescription'
testFFT/CAStreamBasicDescription.h:298:0 testFFT/CAStreamBasicDescription.h:298: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
testFFT/CAStreamBasicDescription.h:299:0 testFFT/CAStreamBasicDescription.h:299: error: expected '=', ',', ';', 'asm' or '__attribute__' before '==' token
testFFT/CAStreamBasicDescription.h:301:0 testFFT/CAStreamBasicDescription.h:301: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!=' token
testFFT/CAStreamBasicDescription.h:302:0 testFFT/CAStreamBasicDescription.h:302: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
testFFT/CAStreamBasicDescription.h:303:0 testFFT/CAStreamBasicDescription.h:303: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>=' token
testFFT/CAStreamBasicDescription.h:304:0 testFFT/CAStreamBasicDescription.h:304: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>' token
testFFT/CAStreamBasicDescription.h:307:0 testFFT/CAStreamBasicDescription.h:307: error: expected ';', ',' or ')' before '&' token
testFFT/CAXException.h:65:0 testFFT/CAXException.h:65: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CAX4CCString'
testFFT/CAXException.h:87:0 testFFT/CAXException.h:87: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CAXException'
testFFT/AQRecorder.h:59:0 testFFT/AQRecorder.h:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'AQRecorder'
testFFT/RecorderLink.h:57:0 testFFT/RecorderLink.h:57: error: expected specifier-qualifier-list before 'AQRecorder'
testFFT/RecorderLink.h:62:0 testFFT/RecorderLink.h:62: error: expected specifier-qualifier-list before 'AQRecorder'

有什么想法吗?

Cheers

Nik

推荐答案

头文件变成纯Objective-C代码( .m ) - 这将无法工作,你必须使用 Objective-C ++ .mm )或封装C ++使用不透明指针的Objective-C类中的类。

You are indirectly including the C++ headers into plain Objective-C code (.m) - that won't work, you have to use Objective-C++ (.mm) all the way or encapsulate the C++ classes in Objective-C classes using opaque pointers.

一个有问题的链:


  • 类/ MainViewController.m ,纯Objective-

  • RecorderLink.h 包括

  • AQRecorder.h ,这是C ++

  • Classes/MainViewController.m, plain Objective-C, includes
  • RecorderLink.h, includes
  • AQRecorder.h, which is C++

这篇关于C ++从SpeakHere在iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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