小编Jas*_*eng的帖子

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

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

错误消息是:

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: …

c++ xcode stl

6
推荐指数
1
解决办法
1万
查看次数

如何在C++中修复回溯行号错误

我想在跟踪程序捕获异常的一些信息时遇到问题.

我使用了以下功能:

extern "C" void log_backtrace()
{   
    // Dump the callstack
    int callstack[128];
    int  frames = backtrace((void**) callstack, 128);
    char** strs = backtrace_symbols((void**) callstack, frames);

    for (int i = 1; i < frames; ++i)
    {
        char functionSymbol[64*1024];
        char moduleName    [64*1024];
        int  offset        = 0;
        sscanf(strs[i], "%*d %s %*s %s %*s %d", &moduleName, &functionSymbol, &offset);
        int addr = callstack[i];
        int   validCppName;
        char* functionName = abi::__cxa_demangle(functionSymbol, NULL, 0,
                                             &validCppName);
        if (validCppName == 0)
            printf(   "\t%8.8x — %s + %d\t\t(%s)\n", addr, functionName, offset, …
Run Code Online (Sandbox Code Playgroud)

c++ macos backtrace debug-symbols

3
推荐指数
1
解决办法
2462
查看次数

标签 统计

c++ ×2

backtrace ×1

debug-symbols ×1

macos ×1

stl ×1

xcode ×1