Implicit declaration of PlayPrompt not allowed in C99

I am trying to pass a string variable (audio file name) to the below function (PlayPrompt) but I get a warning the first time I try to call the function. The compilation then fails as well.

I am pretty sure it is all in the way I am declaring the function itself and it is probably pretty simple but cannot figure it out. I have looked at other similar post and tried various methods of declaration and calling to no avail.

- (void) PlayPrompt: (NSString *) Prompt
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL (mainBundle, (CFStringRef) @"ten", CFSTR ("caf"), CFSTR("Resources/Audio files"));
UInt32 soundID;
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundID);
AudioServicesPlaySystemSound (soundID);
}

- (void)updateTimer
{
if (Countdown_flag)
{
if (Minutes == -5 & Seconds == 0){

}
if (Minutes == -4 & Seconds == 0) {

}
if (Minutes == -3 & Seconds == 0) {

}
if (Minutes == -2 & Seconds == 0) {

}
if (Minutes == -1 & Seconds == 0) {
PlayPrompt();//("oneminute");
}

The function is hardcoded to play the file ten at the moment so any pointers in how I would pass the variable in the most efficient way and then use it in CFBundleCopyResourceURL would be welcome as well.

Regards

Matt
No offence, but that's a strange (and I think obsolescent) way of declaring functions. Also, this is kinda hard to fix because I don't know of the functions you're calling in PlayPrompt.

Also, give the full compile log.

Finally, could you re-post your code but in tags? It makes it much more readable. Like this:

 
exampleCode = easierToRead;
Last edited on
Thanks for the response.

The functions in PlayPrompt are iOS API's which, when run from the update timer function run correctly. I have not declared a prototype for PlayPromt in the header file for the .m file where both the update timer and Playprompt reside.

More precise code is below which should show it more clearly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- (void) PlayPrompt: (NSString *) Prompt
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL (mainBundle, (CFStringRef) @"ten", CFSTR ("caf"), CFSTR("Resources/Audio files"));
UInt32 soundID;
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundID);
AudioServicesPlaySystemSound (soundID); 
}

- (void)updateTimer
{
if (Countdown_flag)
{
if (Minutes == -1 & Seconds == 0) {
PlayPrompt("oneminute");
}
}


The thing that confuses me is that I have other functions declared in the same file with no problems. I am having problems getting the compile log as X code does not want to give it up.

Regards

Matt
Topic archived. No new replies allowed.