snprintf not a member of std in c++locale.h

  • Paul Dufresne

    Paul Dufresne - 2012-06-15

    Well, I am not too good at C and C++.
    Here I am trying to compile a console program written in C++, and after having
    created a project file that does seems to have the correct include
    directories, I now get a last bug that seems internal to Dev-C++.
    Googling 'snprintf not a member of std' seems to show that the problems would
    exist from about 2006.

    Anyway, I am using a beta version: Dev-C++ on Windows XP.
    68 C:\Dev-Cpp\include\c++\3.4.2\mingw32\bits\c++locale.h snprintf' is not a member ofstd'

    Should probably mention that I do have a locally, manually installed MinGW
    somewhere else on the box.

  • Paul Dufresne

    Paul Dufresne - 2012-06-15

    People on the net seems to suggest that the solution is to uncheck the
    recursive include checkbox.
    I do not find this checkbox.

    For now my workaround was to comment out:
    In c++locale.h:
    //#ifdef _GLIBCXX_USE_C99
    // const int ret = std::snprintf(out, size, fmt, prec, v);
    const int ret = std::sprintf(out, fmt, prec, v);

    And in cstdio:


    //using ::snprintf;
    using ::vfscanf;

    and later in the same file:
    namespace std
    //using gnu_cxx::snprintf;

    Now compilation seems to go a bit farther.

  • Paul Dufresne

    Paul Dufresne - 2012-06-15

    hum hum Well, now that I read I realize that these people having this bug were on a Mac IDE called Xcode. And that's where the 'recursive include' checkbox must be.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks