Thread: snprintf warning error

  1. #1
    Join Date
    Mar 2005

    snprintf warning error


    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.


  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    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
    Join Date
    Mar 2005
    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
    Cambridge, UK
    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.


  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    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, 05: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, 05:27 AM