Mail Archives: djgpp/2013/04/02/22:59:14
> 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 -