包含<string>时<cstdio>出错</string> </cstdio>

时间:2011-03-23 08:42:10

标签: 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,

1 个答案:

答案 0 :(得分:3)

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