microsoft / WinObjC

Objective-C for Windows
MIT License
6.24k stars 809 forks source link

AVAudioPlayer (AVFoundation) compile errors #395

Closed cre8ivepark closed 8 years ago

cre8ivepark commented 8 years ago

I am using this code below to play simple audio clip. When I compile this, I got the error messages below.

NSString *backgroundMusicPath = [[NSBundle mainBundle] pathForResource:@"clapping01" ofType:@"mp3"];
NSURL *backgroundMusicURL = [NSURL fileURLWithPath:backgroundMusicPath];
self.backgroundMusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:backgroundMusicURL error:nil];
self.backgroundMusicPlayer.delegate = self;  
self.backgroundMusicPlayer.numberOfLoops = -1;  

[self.backgroundMusicPlayer prepareToPlay];

Severity Code Description Project File Line Suppression State Error could not build module 'AudioToolbox' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMedia\CMFormatDescription.h 19
Error could not build module 'AVFoundation' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\OneDrive\Dev\Bori\Bori_Git\PoriFashionShow-Islandwood\Mademoiselle Pori\FashionShowViewController.h 10
Error could not build module 'CoreAudio' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\AudioToolbox\AudioConverter.h 19
Error could not build module 'CoreAudio' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\AudioUnit\AUAudioUnit.h 20
Error could not build module 'CoreMedia' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\AVFoundation\AVAsset.h 24
Error declaration of 'int32_t' must be imported from module 'CoreFoundation' before it is required Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMedia\CMTypes.h 24
Error declaration of 'uint32_t' must be imported from module 'CoreFoundation' before it is required Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreVideo\CVBuffer.h 25
Error must use 'struct' tag to refer to type 'MIDIThruConnectionEndpoint' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 74
Error must use 'struct' tag to refer to type 'MIDIThruConnectionEndpoint' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 76
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 80
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 81
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 82
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 83
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 84
Error must use 'struct' tag to refer to type 'MIDITransform' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreMIDI\MIDIThruConnection.h 85
Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 119 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 122 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 122 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 122 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 128 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 129 Error unknown type name 'bool' Mademoiselle Pori (Mademoiselle Pori\Mademoiselle Pori) F:\WinObjC\include\CoreAudio\CoreAudioTypes.h 130

rajsesh commented 8 years ago

@cre8ivepark can you please verify if this still happens in the latest release? We had an incorrect project dependency in AutoToolbox that may be the root cause. Also, can you paste the imports in your source code if this still repros?

rajsesh commented 8 years ago

@cre8ivepark thanks for sending the code snippet. The issue is reproducible when importing <AVFoundation/AVFoundation.h> from a .m file. It would compile fine in a .mm file (because the header and dependencies were using C++ constructs). Fix is on the way.