jun-zhang / msinttypes

Automatically exported from code.google.com/p/msinttypes
0 stars 0 forks source link

Compiler warnings when included in conjunction with VS2010's stdint.h. #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Steps to reproduce:
In Visual Studio 2010, create an application that includes stdint.h from 
msinttypes as well as the compiler's included stdint.h.

Attempt to build it. You will receive several compiler warnings about 
redefinition of macros, typedefs, etc.

Solution:
Within stdint.h, if the compiler provides its own stdint.h, include the 
compiler's version rather than manually defining everything, e.g...

#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]

#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_

#if _MSC_VER > 1000
#pragma once
#endif

#if _MSC_VER >= 1600

#include <stdint.h>

#else

// ...remainder of file...

#endif

Original issue reported on code.google.com by louse...@gmail.com on 5 Jan 2011 at 9:58

GoogleCodeExporter commented 8 years ago
Fyi, Visual Studio 2010 provides stdint.h but not inttypes.h. So inttypes.h 
does not need changed.

Original comment by louse...@gmail.com on 5 Jan 2011 at 10:01

GoogleCodeExporter commented 8 years ago
Commited as r28. Thank you!

Original comment by alexander.chemeris on 24 May 2013 at 10:32