C ++ from SpeakHere in iPhone app

I created a template application where I grabbed a part of the SpeakHere example record and deleted the file processing part, but I try my best to make the C ++ application work correctly. As soon as it enters the C ++ class, it gets syntax errors. If I do not import the header files from C ++ (and then, of course, do not use the code) into my Objective-C classes, everything works fine. I do not see the difference between the way I do it, and the example does it. Do you see the difference?

I have posted all the code here: http://github.com/niklassaers/testFFT

The build errors that I get are as follows:

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' 

Any idea what is going on here?

Greetings

Nick

+4
source share
1 answer

You indirectly include C ++ headers in regular Objective-C code ( .m ) - this will not work, you must use Objective-C ++ ( .mm ) completely or encapsulate C ++ classes in Objective-C classes using opaque pointers .

One problem chain:

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

Source: https://habr.com/ru/post/1308383/


All Articles