[LLVMdev] LLVM 3.4: snprintf() with g++ -std=c++11: error: 'snprintf' was not declared in this scope

zosrothko zosrothko at orange.fr
Sun Mar 9 01:41:11 PST 2014


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.




More information about the llvm-dev mailing list