简体   繁体   English

c++ 编译失败并出现错误:命名空间“std”中没有名为“snprintf”的成员

[英]c++ compile fail with error: no member named 'snprintf' in namespace 'std'

It can be compiled successfully a few minutes ago.几分钟前就可以编译成功了。 And the issue cames after my trying to build the project by pressing the "Profile" button.在我尝试通过按下“配置文件”按钮来构建项目之后出现了这个问题。 After that, my project cannot be compiled any more.在那之后,我的项目就不能再编译了。

The error message is:错误信息是:

In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/latte_prefix.h:24:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ios:42:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iosfwd:44:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits/c++locale.h:48:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/cstdio:52:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/tr1/stdio.h:37:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:46:14: error: no member named 'snprintf' in namespace 'std'
  using std::snprintf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:47:14: error: no member named 'vsnprintf' in namespace 'std'
  using std::vsnprintf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:49:14: error: no member named 'vfscanf' in namespace 'std'
  using std::vfscanf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:50:14: error: no member named 'vscanf' in namespace 'std'
  using std::vscanf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:51:14: error: no member named 'vsscanf' in namespace 'std'
  using std::vsscanf;
        ~~~~~^
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/latte_prefix.h:24:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ios:42:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iosfwd:44:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits/c++locale.h:48:
/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/cstdio:99:11: error: no member named 'FILE' in the global namespace
  using ::FILE;
        ~~^
/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/cstdio:100:11: error: no member named 'fpos_t' in the global namespace
  using ::fpos_t;
        ~~^
/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/cstdio:102:11: error: no member named 'clearerr' in the global namespace
  using ::clearerr;
        ~~^

the compile script is:编译脚本是:

ProcessPCH++ /var/folders/r7/g6yvk_7s2zg0w0tndvr74qwc0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/latte_prefix-calwfgjtbaftrwfxqlbgygvcoqtm/latte_prefix.h.pth latte_prefix.h normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte
    setenv LANG en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++-header -arch x86_64 -fmessage-length=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-newline-eof -Wc++11-extensions -DNET_DUMP=0 -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -fasm-blocks -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.7 -g -Wno-conversion -Wno-sign-conversion -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/build/latte.build/Debug/latte.build/latte.hmap -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../sdk -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/build/Debug/include -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/build/latte.build/Debug/latte.build/DerivedSources/x86_64 -I/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/build/latte.build/Debug/latte.build/DerivedSources -Wall -F/Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/build/Debug --serialize-diagnostics /var/folders/r7/g6yvk_7s2zg0w0tndvr74qwc0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/latte_prefix-calwfgjtbaftrwfxqlbgygvcoqtm/latte_prefix.h.dia -c /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/latte_prefix.h -o /var/folders/r7/g6yvk_7s2zg0w0tndvr74qwc0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/latte_prefix-calwfgjtbaftrwfxqlbgygvcoqtm/latte_prefix.h.pth -MMD -MT dependencies -MF /var/folders/r7/g6yvk_7s2zg0w0tndvr74qwc0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/latte_prefix-calwfgjtbaftrwfxqlbgygvcoqtm/latte_prefix.h.d

snprintf() comes from the C99 standard. snprintf()来自C99标准。 You should not use namespace std for it.你不应该为它使用命名空间std Just use the global namespace.只需使用全局命名空间。

Don't forget to include stdio.h不要忘记包含stdio.h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM