delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/04/02/22:59:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Wed, 03 Apr 2013 05:44:21 +0300
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: snprintf not found
In-reply-to: <515B8EE7.4060603@usc.edu>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <83ehesib96.fsf@gnu.org>
References: <515B8EE7 DOT 4060603 AT usc DOT edu>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Tue, 02 Apr 2013 18:07:35 -0800
> From: Mikhail Ryazanov <ryazanov AT usc DOT edu>
> 
> I have a problem compiling programs with snprintf (actually, vsnprintf) 
> function. Although it is described in the documentation 
> [http://www.delorie.com/djgpp/doc/libc/libc_732.html] and is present in 
> the provided header files, a simple test program
> 
> #include <stdio.h>
> int main(void) {
>    return snprintf(NULL, 0, "%d", 123);
> }
> 
> fails to compile both in C++ mode:
> 
> ... error: 'snprintf' was not declared in this scope
> 
> (playing with <cstdio> and various possible scopes does not help) and in C:
> 
> ... warning: implicit declaration of function 'snprintf' 
> [-Wimplicit-function-declaration]
> ... warning: incompatible implicit declaration of built-in function 
> 'snprintf' [enabled by default]
> ... undefined reference to `snprintf'

snprintf is only available in (yet unreleased) version v2.04 of the
library.  Are you using that, or do you have v2.03 installed?  If the
latter, then indeed there's no snprintf.

> I found a probably related discussion at 
> [http://cygwin.com/ml/cygwin/2012-04/msg00140.html] (about one year 
> ago), but it seems that there the problem was only for particular 
> "-std=" choices, whereas current DJGPP fails with _any_ kind of C/C++ 
> standard (including "gnu...").

Cygwin is not related to DJGPP.

> P.S. For comparison, gcc 4.6.1 in Debian works fine.

GCC version has nothing to do with this.  Standard functions are
implemented in the library, not in the compiler.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019