jfalexvijay
jfalexvijay

Reputation: 3711

Integration of CPP with Objective C

I want to call a CPP function from Objective C. I have written the function in CPP. I have tried to call the CPP function from test.mm file, but I am getting following error message.

error: 'functionName' was not declared in this scope

I have written the function 'functionName' in testCPP.cpp & testCPP.h

Please help me to resolve it.

//Objective-C (.mm)
#import "MergeAudios.h"
#import "MergeAudioFiles.h" // cpp header file

@implementation MergeAudios

-(void)mergeAudioFile1:(CFURLRef)path1 file2:(CFURLRef)path2 withFile:(CFURLRef)path3{
    CombineAudioFiles(path1, path2, path3);
}

@end
// CPP (.cpp)

void CombineAudioFiles(CFURLRef sourceURL1, CFURLRef sourceURL2, CFURLRef destinationURL) 
{
......
......
}

Upvotes: 0

Views: 675

Answers (1)

Tom Dalling
Tom Dalling

Reputation: 24125

Did you #include "testCPP.h"?

The functions need to be declared in MergeAudioFiles.h, just like in normal C++.

Upvotes: 1

Related Questions