zosrothko
2014-Mar-09 09:41 UTC
[LLVMdev] LLVM 3.4: snprintf() with g++ -std=c++11: error: 'snprintf' was not declared in this scope
Hi I am building LLVM 3.4 on a cygwin platform $ uname -a CYGWIN_NT-6.1 idefix 1.7.28(0.271/5/3) 2014-02-09 21:06 x86_64 Cygwin $ g++ --version g++ (GCC) 4.8.2 and got this error from gcc In file included from /cygdrive/z/dev/llvm/x64/llvm/lib/Support/BranchProbability.cpp:16:0: /cygdrive/z/dev/llvm/x64/llvm/include/llvm/Support/Format.h: In instantiation of ‘int llvm::format_object1<T>::snprint(char*, unsigned int) const [with T = double]’: /cygdrive/z/dev/llvm/x64/llvm/lib/Support/BranchProbability.cpp:36:1: required from here /cygdrive/z/dev/llvm/x64/llvm/include/llvm/Support/Format.h:87:49: erreur: ‘snprintf’ was not declared in this scope return snprintf(Buffer, BufferSize, Fmt, Val); In the Cygwin mailing list, this thread "http://cygwin.com/ml/cygwin/2012-04/msg00140.html" explains the problem that I have reproduced fully and states it could be a bug in gcc . The proposed workarounds are 1/ use -std=gnu11 which works 2/ explicitly declare int snprintf ( char * s, size_t n, const char * format, ... ); IMHO, meantime fixing the gcc, I would suggest to keep the c++11 standard and explicitly declare the signature of snprintf. Any thought on this issue? Regards -- View this message in context: http://llvm.1065342.n5.nabble.com/LLVM-3-4-snprintf-with-g-std-c-11-error-snprintf-was-not-declared-in-this-scope-tp66647.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Csaba Raduly
2014-Mar-14 08:59 UTC
[LLVMdev] LLVM 3.4: snprintf() with g++ -std=c++11: error: 'snprintf' was not declared in this scope
Hi, On Sun, Mar 9, 2014 at 10:41 AM, zosrothko wrote: (snip)> 'snprintf' was not declared in this scope > return snprintf(Buffer, BufferSize, Fmt, Val); > > In the Cygwin mailing list, this thread > "http://cygwin.com/ml/cygwin/2012-04/msg00140.html" explains the problem > that I have reproduced fully and states it could be a bug in gcc . The > proposed workarounds are > > 1/ use -std=gnu11 which works > 2/ explicitly declare int snprintf ( char * s, size_t n, const char * > format, ... ); >This should now be fixed. http://clang-developers.42468.n3.nabble.com/Re-MinGW-build-does-not-compile-with-C-11-td4038387.html Csaba -- GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ The Tao of math: The numbers you can count are not the real numbers. Life is complex, with real and imaginary parts. "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds "People disagree with me. I just ignore them." -- Linus Torvalds