Getting fatal error when including <stdlib>
I got a fatal error that the file or directory <stdlib>
is not found on ubuntu 11.xx
when I typed #include <stdlib>
.
Is <stdlib>
deprecated/removed, or is there something wrong with my GCC 开发者_开发技巧installation?
In C++ code, include 'cstdlib' instead.
#include <cstdlib>
If you are using C, include 'stdlib.h'
#include <stdlib.h>
In c++ code, always prefer the cXXX include instead of XXX.h
Presumably you are attempting to include the C standard library header stdlib.h
.
Thing is, in C++, the old C headers x.h
are deprecated; you should not use them. Fortunately, C++ allows you to use C++ versions of them:
#include <cstdlib>
It's pretty much the same thing, but wrapped into the std::
namespace ... and not deprecated.
Anyway, you got your error because there's certainly no standard header named just stdlib
.
精彩评论