Thread: Function ... should have prototype ?

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    43

    Question Function ... should have prototype ?

    some Times I receive this message then I know that I didn't
    include the file that contain the func.
    But some times I receive it although I did the #Include.

    What's the problem here???

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Well then either:

    A) It's your own function, and you have no protoype for it
    or
    B) You included the wrong header

  3. #3
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    As Ken said, it sounds like you aren't including the proper header files, or you aren't declaring your function prototypes.

    Can you post an example of some code that gets those errors?

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >some Times I receive this message then I know that I didn't
    >include the file that contain the func.
    >But some times I receive it although I did the #Include.

    You write: the file that contains the function. You don't mean you're including a C file do you?

    Some possible reasons:

    1. In function A you are calling function B, but function A is placed before function B in the code. In that case the compiler doesn't know about function B when compiling function A.

    2. In file A you are calling a certain function placed in file B, but you haven't declared that function with "extern" prototype in file A.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Put all your prototypes in a single include file, called say Include.h

    #include "Include.h" in all files in the project.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. call to function without prototype
    By lgbeeb in forum C Programming
    Replies: 2
    Last Post: 03-25-2003, 12:20 PM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM