Function ... should have prototype ?

This is a discussion on Function ... should have prototype ? within the C Programming forums, part of the General Programming Boards category; some Times I receive this message then I know that I didn't include the file that contain the func. But ...

  1. #1
    c--
    c-- is offline
    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,230
    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,386
    >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,856
    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, 06:18 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. call to function without prototype
    By lgbeeb in forum C Programming
    Replies: 2
    Last Post: 03-25-2003, 11:20 AM
  5. Replies: 5
    Last Post: 02-08-2003, 06:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21