2010-04-29 3 views
4

SpeakHere 예제의 녹음 부분을 잡고 파일 처리 부분을 제거한 템플릿 응용 프로그램을 만들었지 만 응용 프로그램의 C++ 부분을 올바로 작동시킬 수는 없습니다. . C++ 클래스에 들어가 자마자 구문 오류가 발생합니다. C++에서 헤더 파일을 가져 와서 Objective C 클래스에 코드를 사용하지 않으면 모든 것이 잘 동작합니다. 내가하는 일과 내가하는 일의 차이점을 볼 수 없다. 차이점을 확인할 수 있습니까? http://github.com/niklassaers/testFFTC++ SpeakHere from iPhone app

내가 할 빌드 오류는 다음과 같습니다 : 여기에 무슨 일이 일어나고 있는지

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' 

어떤 생각

나는 여기에 전체 코드를 게시 한?

건배

닉 당신은 간접적으로 C++ 일반 목표 - C 코드로 헤더 (.m)를 포함하는

답변

5

- 당신이 Objective-C++ (.mm) 모든 방법을 사용하거나 캡슐화 할 필요가 작동하지 않습니다 opaque pointers을 사용하는 Objective-C 클래스의 C++ 클래스

한 문제 체인 :

  • Classes/MainViewController.m, 일반 오브젝티브 C는,
  • RecorderLink.h를 포함하는 C++
+0

이 그래서 MainViewController 이름을 변경하도록 권고 할 것입니다

  • AQRecorder.h을 포함 .m : MainViewController.mm? – niklassaers

  • +0

    @niklassaers : 위의 체인을 따라 가면, 개인적으로 C++과 Objective-C (응용 프로그램 코어 및 GUI 계층)의 이미 좋은 분리를 유지하려고합니다.이 예에서는 C++ 포함 및 C++ 포인터 만 가져야합니다. 'RecorderLink.h '를 타자하십시오. 하나의 가능한 방법 여기를 참조하십시오 : http://stackoverflow.com/questions/2262011/adding-c-object-to-objective-c-class/2262395#2262395 –

    +0

    짜잔, 불투명 포인터를 사용하여 구현 – niklassaers