Your using
declaration is in game.cpp
, not game.h
where you actually declare string variables. You intended to put using namespace std;
into the header, above the lines that use string
, which would let those lines find the string
type defined in the std
namespace.
As others have pointed out, this is not good practice in headers — everyone who includes that header will also involuntarily hit the using
line and import std
into their namespace; the right solution is to change those lines to use std::string
instead
Related Posts:
- Replace part of a string with another string
- printf with std::string?
- I’m getting the error “stoi is not a member of std” in myprogramminglab [duplicate]
- Why the switch statement cannot be applied on strings?
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Easiest way to convert int to string in C++
- Why is “using namespace std;” considered bad practice?
- std::string to char*
- How to convert string to char array in C++?
- C++ — expected primary-expression before ‘ ‘
- C++ string to double conversion
- Conversion from string to char – c++
- How to find out if an item is present in a std::vector?
- What is `CString`?
- How do I include the string header?
- Differences between C++ string == and compare()?
- How do I convert a double into a string in C++?
- Split a string using C++11
- How do I iterate over the words of a string?
- Check if a string contains a string in C++
- How do I reverse a C++ vector?
- How do I iterate over the words of a string?
- Returning an empty string : efficient way in c++
- C++ string to double conversion
- What is use of c_str function In c++
- How to reverse an std::string? [duplicate]
- C++ Parsing input string to variables
- std::string to char*
- Issue with std::stol – ‘std::invalid_argument’ what(): stol
- How to convert a std::string to const char* or char*
- Is there a tab equivalent of std::endl within the standard library?
- How do I tokenize a string in C++?
- Why use string::iterator rather than index?
- C++ deprecated conversion from string constant to ‘char*’
- identifier “string” undefined?
- Press Enter to Continue
- Converting a vector
to string - Parsing a comma-delimited std::string
- How can I convert const char* to string and then back to char*?
- std::string formatting like sprintf
- Sorting Characters Of A C++ String
- basic_string::_M_construct null not valid after constructing subvector of strings
- How to return a string from a C++ function?
- std::out_of_range error?
- What is the difference between isdigit() and isnumber()?
- Convert char* to string C++
- Convert a String In C++ To Upper Case
- Right way to split an std::string into a vector
- Read whole ASCII file into C++ std::string
- C++: std does not have member “string”
- C++ String Variable Declaration
- Split a string into an array in C++
- splitting a string into an array in C++ without using vector
- Remove spaces from std::string in C++
- Remove spaces from std::string in C++
- c++ convert string to hex
- How can I iterate through a string and also know the index (current position)?
- c++ parse int from string [duplicate]
- Hash function for a string
- C++ strings and pointers
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- How to Convert a C++ String to Uppercase
- std::wstring VS std::string
- C++ Simple hangman game
- std::cin input with spaces?
- Remove First and Last Character C++
- C++ Remove punctuation from String
- C++ string to enum
- C++ Convert string (or char*) to wstring (or wchar_t*)
- C++ – Assigning null to a std::string
- How to alphabetically sort strings?
- Hash function for a string
- Reading string by char till end of line C/C++
- How do I check if a C++ std::string starts with a certain string, and convert a substring to an int?
- Fastest way to Convert String to Binary?
- Why I cannot cout a string?
- How to print a string in C++
- std::string length() and size() member functions
- How to convert QString to int?
- Which is faster C++ String length() or size()?
- How do I create a random alpha-numeric string in C++?
- Is string::compare reliable to determine alphabetical order?
- Trying to use int in getline
- error: switch quantity not an integer
- Reading a string from file c++
- Remove last character from C++ string
- Function stoi not declared
- Converting String to Cstring in C++
- c++ sizeof( string )
- How to do std::string indexof in C++ that returns index of matching string?
- variable or field declared void
- Function stoi not declared
- error C2065: ‘cout’ : undeclared identifier
- convert string to size_t
- ‘setprecision’ is not a member of ‘std’
- Converting bool to text in C++
- Why are there two different getline() functions (if indeed there are)?
- Why does my program give “NULL used in arithmetic”
- Declaration is incompatible with type