Why do stdint.h can be found but cstdint not?
Asked Answered
T

1

10

I'm be suprised with that include stdint.h works but include cstdint not.

$ aCC sizeof.cpp
"sizeof.cpp", line 5: error #2005-D: could not open source file "cstdint"
  #include <cstdint>
                    ^

1 error detected in the compilation of "sizeof.cpp".
$ aCC --version
aCC: HP C/aC++ B3910B A.06.12 [Nov 03 2006]

It's same with g++:

$ g++ --version
g++ (GCC) 4.2.3

May I ask why? And, have any method to fixed this problem but updating compiler? Thank you.

Toil answered 2/5, 2012 at 5:59 Comment(2)
Where does cstdint come from?Nairn
In gcc 4.2.3, you might find <cstdint> under tr1 <tr1/cstdint>Task
F
9

Your compiler supports the old C++ standard which has no <cstdint> (as C90 had no <stdint.h>). <cstdint> is new to C++11.

Flurry answered 2/5, 2012 at 6:6 Comment(3)
@Charles Bailey is right. Latest gcc (4.6.3) on my machine has experimental support for C++0x and warns "#error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options."Satang
Oh, i see, thank you. But now, the question is: why does c99 support stdint.h but c++03 dose not support cstdint?Toil
@van: That's just the way it is. The version of the C standard referenced by C++03 (because it's only a minor update to C++98) is/was still C90.Flurry

© 2022 - 2024 — McMap. All rights reserved.