Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm getting the error

error: 'INT32_MAX' was not declared in this scope

But I have already included

#include <stdint.h>

I am compiling this on (g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) with the command

g++ -m64 -O3 blah.cpp

Do I need to do anything else to get this to compile? or is there another C++ way to get the constant "INT32_MAX"?

Thanks and let me know if anything is unclear!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
484 views
Welcome To Ask or Share your Answers For Others

1 Answer

Quoted from the man page, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before <stdint.h> is included".

So try:

#define __STDC_LIMIT_MACROS
#include <stdint.h>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...