2012-04-11 1 views
1

이전에 성공적으로 완료된 iOS 앱에 AMR-NB 디코딩 지원을 추가하려고했습니다. 그러나 내가 사용한 프레임 워크 (PhoneGap, 현재는 Cordova)를 업그레이드 한 이후로 새 프로젝트를 시작하고 모든 코드를 새 코드로 마이그레이션하면 AMR-NB 라이브러리가 링크 구문을 작성하는 동안 오류가 발생하기 시작합니다.xCode 4.3.2 링크 오류가 있지만 아치가 있습니다. 왜?

enter image description here

내가 '사러가 -info' '파일'와 명령을 사용하여 운영자와 lib 디렉토리 파일을 확인했습니다

, 그리고 지방 LIB는 i386을 아치가 들어 확인했다, 그것은 이미 연결 구문에 포함 빌드 구. 나는 새 프로젝트와 이전 프로젝트의 빌드 설정을 비교해 왔지만이를 해결할 운이 없다.

내가 잘못 알고있는 사람이 누구인가요? 고마워!

업데이트 :

amrFileCodec.h

// amrFileCodec.h 
// Created by Tang Xiaoping on 9/27/11. 
// Copyright 2011 test. All rights reserved. 

#ifndef amrFileCodec_h 
#define amrFileCodec_h 
#include <stdlib.h> 
#include <string.h> 
#include <stdio.h> 
#include "interf_dec.h" 
#include "interf_enc.h" 

... 

// 将AMR文件解码成WAVE文件 
int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename); 

#endif 

에게 CJ-Func.m

// CJ-Func.m 
// iBear 
// Created by Chris Jiang on 11-4-22. 
// Copyright 2011 Individual. All rights reserved. 

#import "CJ-Func.h" 
#import "interf_dec.h" 
#import "interf_enc.h" 
#import "amrFileCodec.h" 

@implementation MyPGPlugFunc 

... 

- (void)decodeAMR:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { 
    NSArray *currentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *basePath = [currentPaths objectAtIndex:0]; 
    NSString *wavDir = [basePath stringByAppendingPathComponent:@"tmp/wav"]; 
    NSString *wavPath = [basePath stringByAppendingPathComponent:[arguments objectAtIndex:1]]; 

    NSLog(@"[CJ-FUNC] Decoding %@ to %@", [arguments objectAtIndex:0], wavPath); 

    BOOL isDir = YES; 
    NSFileManager *fileMgr = [NSFileManager defaultManager]; 
    if (![fileMgr fileExistsAtPath:wavDir isDirectory:&isDir]) { 
     if (![fileMgr createDirectoryAtPath:wavDir withIntermediateDirectories:YES attributes:nil error:nil]) 
      NSLog(@"[CJ-FUNC] ERROR: tmp/wav directory creation failed"); 
     else 
      NSLog(@"[CJ-FUNC] tmp/wav directory created"); 
    } 
    [fileMgr release]; 

    int encRes = DecodeAMRFileToWAVEFile(
     [[arguments objectAtIndex:0] cStringUsingEncoding:NSASCIIStringEncoding], 
     [wavPath cStringUsingEncoding:NSASCIIStringEncoding] 
    ); 

    if (encRes <= 0) 
     [self writeJavascript:[NSString stringWithFormat:@"%@();", [arguments objectAtIndex:3]]]; 
    else 
     [self writeJavascript:[NSString stringWithFormat:@"%@('%@');", [arguments objectAtIndex:2], wavPath]]; 
} 

@end 
+0

나는 5 일 이후로 이러한 유형의 구현을 찾고 있습니다. 귀하의 코드로 성공적으로 완료되었습니다. 감사합니다 ... 해피 코딩. –

답변

1

을 amrFileCodec.h과 CJ-Func.m의 코드 조각 추가 메시지 "아키텍처 i386에 대한 정의되지 않은 심볼"은 라이브러리에 i386 아키텍처가 없음을 의미하지 않습니다.

"_DecodeAMRFileToWaveFile"에서 참조 : 중요한 부분은 다음 라인 - [MyPGPlugFunc decodeAMR : withDict :] 당신이 기능 DecodeAMRFileToWaveFile을 가지고있는 것처럼

CJ-Func.o에 소리() , Obj-C++ .mm 파일에 정의되어 있지만 .m 파일에서 사용하려고합니다. 따라서 C 컴파일 함수와 C++ 컴파일러의 차이점에 대해 설명하고 있습니다. 함수를 평범한 C 함수처럼 보이게하려면 C++에게 알릴 필요가있다.

당신은 당신의 헤더 파일이 필요합니다

#ifdef __cplusplus 
extern "C" { 
#endif 

void DecodeAMRFileToWaveFile(); // or whatever its declaration is 

#ifdef __cplusplus 
} 
#endif 

가 여기 reference in the C++ FAQmore detailed explanation입니다.

+0

나는 이것을 몇 번이고 계속 점검해 왔고, 이것을 해결하는 행운을 찾지 못했다. DecodeAMRFileToWaveFile 함수는 objective-C++로 작성되었고, #incport를 이미 CJ-Func.m에 가져 왔습니다. 그래도 헤더 파일이 .m 파일에 인식되지 않는 것 같습니다. 너무 이상해. @@ " – JiangCat

+0

그 열쇠입니다. 편집 된 답변보기 –

+0

편집을위한 Thx,하지만 난 여전히 이것을 얻지 못합니다. 주요 질문을 편집 할 때 함수의 이름은 'DecodeAMRFileToWaveFile'이며 '_' 링커가 '_DecodeAMRFileToWaveFile'을 찾고있는 것 같습니까? 그 이유는 무엇입니까? CJ-Func.m이 호출 한 부분은 'int encRes = DecodeAMRFileToWAVEFile ...'입니다. – JiangCat