c++visual-studio-2010macrosvisual-studio-macros

Fix macro redefinition in C++


Since intsafe.h and stdint.h both define INT8_MIN. Thus VS2010 generate a warning that says :

    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(72): warning C4005: 'INT8_MIN' : macro redefinition
1>          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\intsafe.h(144) : see previous definition of 'INT8_MIN'

Is there a way to fix that warning in VS2010.


Solution

  • In order simply to make the message go away, you can add the line

    #pragma warning (disable : 4005)
    

    before your first #include statement

    But that doesn't mean you shouldn't heed the warning. See if you can do without one of the two header files, and if not, be very certain of which definition your program is using.