This is the mail archive of the
mailing list for the Cygwin project.
Re: snprintf() with g++ -std=c++98: error: 'snprintf' was not declared in this scope
On Wed, Apr 04, 2012 at 10:02:24AM -0400, Ryan Johnson wrote:
>> On 04/04/2012 9:32 AM, Denis Excoffier wrote:
>> >It could be that snprintf() is not properly declared in<stdio.h>.
>> According to , it's not officially part of c++98 (???). Try
>> gnu++98 instead. As for why it's not in c++0x, there's a problem
>> with the macros being defined  that AFAIK remains unresolved;
>> again the workaround is gnu++0x.
>>  http://cygwin.com/ml/cygwin/2010-01/msg00791.html
>>  http://cygwin.com/ml/cygwin/2011-08/msg00311.html
Oh, i should have found these, at least the first one... For c++0x,
couldn't this be addressed now? As a start, i can (humbly) propose:
--- stdio.h 2012-04-04 14:50:32.000000000 +0159
+++ stdio.h++ 2012-04-04 16:38:21.049273700 +0159
@@ -237,7 +237,7 @@
off_t _EXFUN(ftello, ( FILE *));
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
+#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
int _EXFUN(asiprintf, (char **, const char *, ...)
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple