+ 1

How to use string as type in header file in C++

I wanna use string as a type in my class header file, but even with and without the string lib, it shows me: error: 'string' does not name a type How can I use string in the header?

18th Jul 2019, 12:09 AM
JoĆ£o Pedro
JoĆ£o Pedro - avatar
5 Answers
+ 5
std::string string_name;
18th Jul 2019, 12:45 AM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
+ 3
#include <string>
18th Jul 2019, 12:14 AM
silentlearner
silentlearner - avatar
0
It doesn't work
18th Jul 2019, 12:15 AM
JoĆ£o Pedro
JoĆ£o Pedro - avatar
0
OOOOHHHHH, it's true šŸ‡®šŸ‡³OmkaršŸ•‰ ! I forgot that the namespace STD wasn't used as default.
18th Jul 2019, 1:00 AM
JoĆ£o Pedro
JoĆ£o Pedro - avatar
0
#include <cstring>
5th Aug 2020, 7:07 AM
Satyasish Patranabish
Satyasish  Patranabish - avatar