Thread: -Wall , implicit declaration of function ātimeā?

  1. #1
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153

    -Wall , implicit declaration of function ātimeā?

    I finally took everyone's advice and compiled with -Wall. I whittled down 30 warnings to just 2, and I'm not sure what they mean.

    1) implicit declaration of function ātimeā
    Code:
     srand ( (unsigned)time ( NULL ) );
    2) implicit declaration of function ātoupperā
    Code:
    firstletter[0] = toupper(tempoption->companyname[0]);
    I'm sure it's something simple. But I can't see it.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    man time
    man toupper

    Note the #includes

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    time() is declared in <time.h>. toupper() is declared in <ctype.h>. rand() is declared in <stdlib.h>.

    If you fail to #include those headers, the C compiler does not see all of the declarations. It therefore implicitly assume they are all functions that accept a variable argument list and return int.

    The solution is to #include all of the standard headers needed.

    Incidentally, googling for "C implicit declaration" provides pages of links with answers to this type of question.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153
    Got it. No more warnings. sorry to bother.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implicit Declaration Of Function
    By nathanpc in forum C Programming
    Replies: 1
    Last Post: 01-26-2010, 08:46 PM
  2. implicit declaration of function?
    By BoneXXX in forum C Programming
    Replies: 2
    Last Post: 04-27-2007, 11:04 PM
  3. Implicit declaration of function ...???
    By soothsayer in forum C Programming
    Replies: 8
    Last Post: 08-07-2006, 06:49 AM
  4. Implicit declaration of function
    By soothsayer in forum C Programming
    Replies: 5
    Last Post: 02-28-2006, 02:56 PM
  5. implicit declaration of function getchar(...)?
    By tu_user in forum C++ Programming
    Replies: 5
    Last Post: 01-18-2004, 03:09 AM