iphone - 包含 <string> 时 <cstdio> 出错

标签 iphone c++ gcc

_gnu_cxx::snprintf has not been declared

当我在我的 cpp 中包含字符串时。此错误位于此行:

using ::__gnu_cxx::snprintf;

cstdio 包含在这个顺序中:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/string:47,
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/iosfwd:45,
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/iosfwd:45,

最佳答案

我通过在标题中添加#define _GLIBCXX_USE_C99_DYNAMIC 1 解决了这个问题。

关于iphone - 包含 <string> 时 <cstdio> 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5402663/

相关文章:

ios - 苹果 watch : Can one Watchkit App communicate with more than one iOS App?

iphone - 如何在特定时间发送短信

iphone - 为 webapp 缓存视频 - 坏主意?

c++ - 截断由 ostringstream、iomanip :setw 生成的 C++ 字符串字段

c++ - 具有固定输入行数的 Qt 文本编辑

c++ - 在 C++ 中的类中定义结构

iphone - 如何从 iOS AVAudioRecorder 获取正确比例的分贝读数?

linux - 在 Debian 上链接依赖于位置的程序集

gcc - gcc 编译器标志和符号表之间的函数地址不兼容

assembly - 在 GNU 汇编器宏中引用操作数/参数