Skip to content

'_snprintf': is not a member of 'std' #32

Closed

Description

@babzog

While building our project with Visual Studio 2017 and linking to the new boost 1.69, I encountered the following error:

c:/git/oss/boost/1.69.0\boost/system/detail/system_category_win32.hpp(52): error C2039: '_snprintf': is not a member of 'std'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\functional(23): note: see declaration of 'std'
make.exe[2]: *** [c:/artifacts/build32//client//core/obj/buttercup.obj] Error 2

I don't actually know what series of header #includes led to system_category_win32.hpp being yanked in, but it is... and it built without error when we were using boost 1.51.

Googling didn't really help explain very well, why this is happening.

Activity

  1. pdimov commented on Feb 11, 2019

    @pdimov
    Member

    You have #define snprintf _snprintf somewhere before including the Boost.System header.

  2. pdimov commented on Feb 11, 2019

    @pdimov
    Member

    (This #define should no longer be necessary for VS2015 and above - it has a legitimate snprintf.)

  3. bstaletic commented on Feb 12, 2019

    @bstaletic

    I had this problem. Python.h does the following

    #ifndef HAVE_SNPRINTF
    #define snprintf _snprintf
    #endif 

    You just need to add /DHAVE_SNPRINTF to your flags.

  4. babzog commented on Feb 12, 2019

    @babzog
    Author

    That was indeed my problem. That declaration was littered throughout the code. Thank you for the guidance!

  5. omeryasar commented on Dec 20, 2020

    @omeryasar
    #ifndef HAVE_SNPRINTF
    #define snprintf _snprintf
    #endif 

    Hi, I have the same problem but I don't understand exactly what should I have to do for fixing the problem. Can you please explain your answer

  6. kedakedaxia commented on Dec 23, 2020

    @kedakedaxia

    you can Add to header file "#undef snprintf"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions