X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Date: Wed, 4 Apr 2012 15:32:20 +0200 From: Denis Excoffier To: cygwin AT cygwin DOT com Subject: snprintf() with g++ -std=c++98: error: 'snprintf' was not declared in this scope Message-ID: <20120404133244.GA2056@qp9482> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hello, It could be that snprintf() is not properly declared in . Take the following foo.c: % cat foo.c #include int main(void) { char buf[10]; snprintf(buf, 10, "%i", 0); return 0; } % In C, perhaps after a remark from Markus (http://sourceware.org/ml/cygwin/2009-04/msg00435.html), no compiler message is produced: % gcc -xc -std=c90 -c foo.c % gcc -xc -std=c99 -c foo.c % On the other hand, for C++, a compiler message is produced: % gcc -xc++ -std=c++98 -c foo.c foo.c: In function 'int main()': foo.c:6:28: error: 'snprintf' was not declared in this scope % % gcc -xc++ -std=c++0x -c foo.c foo.c: In function 'int main()': foo.c:6:28: error: 'snprintf' was not declared in this scope % Replacing with produces the same result. Shouldn't snprintf() (and vsnprintf() etc.) be declared in also for the C++ language/standard, especially c++0x? Regards, Denis Excoffier. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple