I have made my own source file, and I'm trying to add stddef.h. At compiling I have the following error:
std::ptrdiff_t' has not been declared.
What I've done wrong?
I have made my own source file, and I'm trying to add stddef.h. At compiling I have the following error:
std::ptrdiff_t' has not been declared.
What I've done wrong?
Copyright © 2021 Jogjafile Inc.
The problem is that you are including the standard C header, not the standard C++ header.
The standard C header will not put their symbols in the
stdnamespace, since C doesn't have such things.That you have other applications requiring the C header doesn't matter, if you want to use the
ptrdiff_ttype-alias from the C++stdnamespace, you must include<cstddef>.Or stop using
std::ptrdiff_tand user the unqualified and globalptrdiff_tfrom<stddef.h>.