snprintf warning error

This is a discussion on snprintf warning error within the C Programming forums, part of the General Programming Boards category; Hi, im getting the following warning during compiling. gol.c:568: warning: implicit declaration of function `snprintf'. snprintf is probably not apart ...

  1. #1
    Waxy-Dock
    Join Date
    Mar 2005
    Posts
    69

    snprintf warning error

    Hi,

    im getting the following warning during compiling. gol.c:568: warning: implicit declaration of function `snprintf'.

    snprintf is probably not apart of standard C and since I was told to use the following flags during compilation; -o gol -ansi -Wall -g, im getting this warning. Is there anyway i can remove this warning and maintain the flags or is this error because of something else completely.

    Thanks

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,700
    The warning means that you've forgotten to include <stdio.h>

    Also, warnings can be as or more important than errors - don't silence the compiler without very good reasons.

  3. #3
    Waxy-Dock
    Join Date
    Mar 2005
    Posts
    69
    but i did.. ive got the following includes

    #include <mpi.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Check out your stdio.h file for snprintf prototype. It should have been included there, If not you might get this error.

    If you see one there, then the warning should be something else related snprintf.

    ssharish2005

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    snprintf was not part of C90, it's a C99 addition or an extension to C90 available to certain compilers.

    It looks like you may be using some variant of gcc, so try adding the flag -std=c99.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

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