Implicit Declaration of Function Printf()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lucasbeirer
    New Member
    • Nov 2015
    • 1

    Implicit Declaration of Function Printf()

    When i try to compile the following program, it says
    "warning: implicit declaration of function 'printf'"
    Heres the source code

    Code:
    #include <stdio.h>
    
    int main(void)
    {
    	prinf("Hello World");
    	return 0;
    
    }
    Last edited by zmbd; Nov 16 '15, 05:37 AM. Reason: [Z{Please use the [CODE/] button to format posted script and formatted text - Please read the FAQ}]
  • Clearner321
    New Member
    • Sep 2015
    • 22

    #2
    Two reasons i can think of
    1. In your actual source code you have not included
    Code:
    #include <stdio.h>
    2. The installation is not proper and the compiler is not able to find the stdio.h file or may be it is pointing to different stdio.h file

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Actually, it's printf not prinf.

      Comment

      • Clearner321
        New Member
        • Sep 2015
        • 22

        #4
        In the warning message it correctly refers to printf.so, I was not sure which is correct?

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          An implicit declaration means to call a function without previously telling the compiler that this is a valid function. You tell the compiler the function is valid by a)coding the function before you call it the first time or b)using a function prototype if the code for the function does not appear before the first call.


          There is no way that the compiler would know you meant printf when prinf is a perfectly good function name.

          Maybe you could post your warning.

          Comment

          Working...