C99 stdint.h header y MS Visual Studio


Para mi sorpresa acabo de descubrir que el stdint C99.falta h de MS Visual Studio 2003 en adelante. Estoy seguro de que tienen sus razones, pero ¿alguien sabe dónde puedo descargar una copia? Sin este encabezado no tengo definiciones para tipos útiles como uint32_t, etc.

Author: Rob, 2008-09-24

7 answers

Resulta que puede descargar una versión MS de este encabezado desde:

Https://github.com/mattn/gntp-send/blob/master/include/msinttypes/stdint.h

Un portátil se puede encontrar aquí:

Http://www.azillionmonkeys.com/qed/pstdint.h

Gracias al blog del software Rambling.

 80
Author: Rob,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-29 23:21:06

Simplemente defínelos usted mismo.

#ifdef _MSC_VER

typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;

#else
#include <stdint.h>
#endif
 45
Author: Nicholas Mancuso,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-12-22 10:47:15

Actualización: Visual Studio 2010 y Visual C++ 2010 Express ambos tienen stdint.h. Se puede encontrar en C:\Program Files\Microsoft Visual Studio 10.0\VC\include

 43
Author: Ashwin Nanjappa,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-04-13 08:26:21

Visual Studio 2003 - 2008 (Visual C++ 7.1 - 9) no afirma ser compatible con C99. (Gracias a rdentato por su comentario.)

 21
Author: Adam Mitz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-09-25 00:23:58

Boost contiene cstdint.archivo de encabezado hpp con los tipos que busca: http://www.boost.org/doc/libs/1_36_0/boost/cstdint.hpp

 11
Author: Nemanja Trifunovic,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-09-24 13:56:48

Microsoft no admite C99 y no ha anunciado ningún plan para hacerlo. Creo que tienen la intención de rastrear los estándares de C++, pero consideran que C es efectivamente obsoleto, excepto como un subconjunto de C++.

Los nuevos proyectos en Visual Studio 2003 y posteriores tienen la opción "Compilar como código C++ (/TP)" configurada por defecto, así que cualquiera .los archivos c se compilarán como C++.

 5
Author: Mike Dimmick,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-09-24 16:04:11

Otra solución portátil:

POSH: El Arnés Portátil de Código Abierto

"POSH es un "arnés" simple, portátil, fácil de usar, fácil de integrar, flexible y de código abierto diseñado para hacer que escribir bibliotecas y aplicaciones multiplataforma sea significativamente menos tedioso de crear y portar."

Http://poshlib.hookatooka.com/poshlib/trac.cgi

Como se describe y se usa en el libro: Escribir código portátil: una introducción al desarrollo de software para múltiples plataforma Por Brian Hook http://books.google.ca/books?id=4VOKcEAPPO0C

-Jason

 4
Author: Jason Harrison,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-25 21:51:50