You forgot to #include <string>
using std::string
without including it’s header works on some compilers that indirectly import parts of <string>
into their <iostream>
or other headers but that’s not standard and shouldn’t be relied upon. Also they often break when you try to output a string since they only included a part of the implementation and are missing the part that implements the operator<<
.
Related Posts:
- C++: std does not have member “string”
- What is a lambda expression in C++11?
- ld: symbol(s) not found for architecture x86_64 error
- What is the ‘override’ keyword in C++ used for? [duplicate]
- What is a smart pointer and when should I use one?
- Meaning of = delete after function declaration
- C++ std::priority_queue uses the lambda expression
- Usage and Syntax of std::function
- What exactly is nullptr?
- Difference between `constexpr` and `const`
- How to use _CRT_SECURE_NO_WARNINGS
- Split a string using C++11
- How to create timer events using C++ 11?
- What does T&& (double ampersand) mean in C++11?
- Segmentation fault error 11 C++
- Why doesn’t C++ have a garbage collector?
- Compiling C++11 with g++
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- What exactly is std::atomic?
- SDL2.DLL missing
- Issue with std::stol – ‘std::invalid_argument’ what(): stol
- terminate called after throwing an instance of ‘std::out_of_range’
- Cleanest way to copy a constant size array in c++11
- push_back vs emplace_back
- undefined reference to ‘std::cout’
- What is move semantics?
- expression preceding parentheses of apparent call must have (pointer-to-) function type
- C++ error: Undefined symbols for architecture x86_64
- C++ terminate called without an active exception
- The #include
exists, but I get an error: identifier “cout” is undefined. Why? - Thread pooling in C++11
- How does std::forward work? [duplicate]
- Identifier is undefined
- Difference in make_shared and normal shared_ptr in C++
- What is std::move(), and when should it be used?
- push_back vs emplace_back
- error: use of deleted function
- Call to implicitly deleted copy constructor in LLVM
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- no match for ‘operator<<’ in ‘std::operator
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- Use the auto keyword in C++ STL
- Call to non-static member function without an object argument compiler error
- Does C++11 have C#-style properties?
- Iterator Loop vs index loop
- initialize a vector to zeros C++/C++11
- When is it safe to call this-> in constructor and destructor
- How to memset char array with null terminating character?
- How well is Unicode supported in C++11?
- The CXX compiler identification is unknown
- How to automatically convert strongly typed enum into int?
- Why should I use a pointer rather than the object itself?
- too many initializers for ‘int [0]’ c++
- overloaded function with no contextual type information
- Creating folders in C++
- MSVCP120d.dll missing
- convert string to size_t
- Compiling C++11 with g++
- ERROR C2039: ‘vector’: is not a member of ‘std’
- Where can I find ‘winmm.lib’ (I’m using Visual Studio 2012)
- Does static constexpr variable inside a function make sense?
- c++ vector bubble sort
- How to use bitmask?
- Differences between unique_ptr and shared_ptr
- C++ convert from 1 char to string?
- Pause Console in C++ program
- What is the array form of ‘delete’?
- Error: Expression must have integral or unscoped enum type
- Use new operator to initialise an array
- Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio
- Undefined Symbols for architecture x86_64: Compiling problems
- “No viable overloaded ‘=’ ” why?
- Check if a string contains a string in C++
- invalid new-expression of abstract class type
- std::string to char*
- Does the ‘mutable’ keyword have any purpose other than allowing the variable to be modified by a const function?
- Random number c++ in some range
- “g++” is not recognized as an internal or external command, MinGW
- Compiling a C++ program with gcc
- Sorting Linked List C++ with pointers
- Get Unix timestamp with C++
- Class prototyping
- How to dynamically allocate an array of pointers in C++?
- How do I compile C++ to JavaScript in a browser?
- Is the sizeof(some pointer) always equal to four?
- How does rhs work?
- error: expected unqualified-id before ‘.’ token //(struct)
- Base class undefined
- C++ – Assigning null to a std::string
- The program can’t start because libgcc_s_dw2-1.dll is missing
- CMake : C and CXX compiler identification is unknown Win10 CMakeGUI
- Error “Unterminated conditional directive” in cross-referencing headers
- C++ template – error: expected initializer before ‘<' token
- Call of overloaded function is ambiguous
- ‘cout’ does not name a type
- C++ Cannot call constructor directly in small example
- C++ compiler error c4430 “c++ doesnt support default int”
- Using OpenMP with clang
- istream and ostream problem – C++
- List iterator not dereferencable?