• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: no previous prototype for function that is defined in header?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no previous prototype for function that is defined in header?


  • Subject: Re: no previous prototype for function that is defined in header?
  • From: Marc Respass <email@hidden>
  • Date: Tue, 25 Jan 2011 17:17:51 -0500

El Jan 25, 2011, a las 4:44 PM, Fritz Anderson escribió:

> On 25 Jan 2011, at 2:19 PM, Marc Respass wrote:
>
>> I have a .m file with nothing but functions in it. There is an accompanying header file with the function prototypes in it and I import the header in the .m. My target has -Wmissing-prototypes turned on and even though I have the header with the prototypes in it, I get "no previous prototype for" function. What am I doing wrong? I had to turn off the warning. I would prefer to keep it on but I don't know how to define my functions so that it will compile. Anyone know what's wrong?
>
> The next step is to bring an editor containing your .m file into focus, and select Build > Preprocess. You will, after some time, be presented with a huge file that shows what the preprocessor is actually passing into the parser. #ifed-out code will be absent. Are your prototypes there?

(replying to the list since I found the answer)

Thanks Fritz,

That was cool. I've never done that though I've read about it. My prototypes appear right above my function definitions. In fact, I added prototypes to my .m just to see what would happen but still got the error.

While I was responding, I was trying various things. I changed my function from foo() to foo(void) and that fixed it. I feel like such a schmuck. I even have my K & R book out but didn't find the answer. Maybe years of Java have replaced my C knowledge but I didn't realize that I had to have "void" in a method that takes no arguments. I checked the C Language Dialect and it's set to GNU99.

Thanks for the help.
Marc _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: no previous prototype for function that is defined in header?
      • From: Mark Wagner <email@hidden>
References: 
 >no previous prototype for function that is defined in header? (From: Marc Respass <email@hidden>)

  • Prev by Date: Why doesn't NSMakePoint work from XCode/gdb?
  • Next by Date: inline, optimize, and call stack visibility?
  • Previous by thread: no previous prototype for function that is defined in header?
  • Next by thread: Re: no previous prototype for function that is defined in header?
  • Index(es):
    • Date
    • Thread