小编vjk*_*ktm的帖子

如何在g ++ -std = c ++ 11版本4.8.2中使用snprintf()

我正在尝试使用-std = c ++ 11的g ++版本4.8.2中的snprintf编译代码,但没有成功.为什么g ++不能识别snprintf?我可以在使用snprintf和c ++ 11时克服这个问题吗?

我得到以下内容:

make all  Building file: ../src/cppHWtest.cpp Invoking: Cygwin C++
Compiler g++ -std=c++11 -D"hash_map=unordered_map" -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"src/cppHWtest.d" -MT"src/cppHWtest.d" -o "src/cppHWtest.o" "../src/cppHWtest.cpp" cygwin warning:   MS-DOS style path detected: C:\Users\poudyal\workspace\cppHWtest\Debug
Preferred POSIX equivalent is:
/cygdrive/c/Users/poudyal/workspace/cppHWtest/Debug   CYGWIN
environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames ../src/cppHWtest.cpp: In function 'int main()':
../src/cppHWtest.cpp:20:35: error: 'snprintf' was not declared in this
scope …
Run Code Online (Sandbox Code Playgroud)

printf cygwin g++ c++11

5
推荐指数
1
解决办法
6329
查看次数

标签 统计

c++11 ×1

cygwin ×1

g++ ×1

printf ×1