identifier "string" undefined?
You want to do #include <string>
instead of string.h
and then the type string
lives in the std
namespace, so you will need to use std::string
to refer to it.
<string.h>
is the old C header. C++ provides <string>
, and then it should be referred to as std::string
.