Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22022

problems with using types from stdint.h header

$
0
0

I have a header file ptestlib.h, whose contents are given below:

#ifndef INCLUDED#define INCLUDED#ifndef FALSE#define FALSE (0)#endif#ifndef TRUE#define TRUE (!FALSE)#endif/* optimization levels */#define OLEVEL1 0x01#define OLEVEL2 0x02#define OLEVEL3 0x03#define OLEVEL4 0x04/* error codes */#define EBADNUM 0x00#define ESYSFAIL 0x01#define EIOFAIL 0x02typedef uint32_t Bool;typedef Bool Test(uint32_t);extern Boolinit(void);/* primality test with optimization level 1 */extern Booltestl1(uint32_t);/* primality test with optimization level 2 */extern Booltestl2(uint32_t);/* primality test with optimization level 3 */extern Booltestl3(uint32_t);/* primality test with optimization level 4 */extern Booltestl4(uint32_t);extern const char *gerrsym[3];#endif

In this header I use uint32_t from <stdint.h>. I don't add #include <stdint.h> to this header file because I use #include <stdint.h> in those source files which use ptestlib.h. That is, each source file which uses ptestlib.h starts with #include <stdint.h> and #include "ptestlib.h". The problem is that uint32_t is called an unknown type name by GCC. But when I move the line #include <stdint.h> to ptestlib.h itself then everything works fine. Why doesn't the compiler see uint32_t when <stdint.h> is included thru source file?


Viewing all articles
Browse latest Browse all 22022

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>