gpt4 book ai didi

C++编译失败,错误: no member named 'snprintf' in namespace 'std'

转载 作者:行者123 更新时间:2023-12-02 01:14:29 25 4
gpt4 key购买 nike

几分钟前就可以编译成功了。在我尝试通过按“配置文件”按钮来构建项目之后,问题就出现了。之后我的项目就无法再编译了。

错误信息是:

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;        ~~^

编译脚本是:

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() 来自C99 标准。您不应该为其使用命名空间 std 。只需使用全局命名空间即可。

不要忘记包含stdio.h

关于C++编译失败,错误: no member named 'snprintf' in namespace 'std' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10054408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com