Why am I getting string does not name a type Error?

前端 未结 5 1864
Happy的楠姐
Happy的楠姐 2020-11-29 19:02

game.cpp

#include 
#include 
#include 
#include \"game.h\"
#include \"         


        
5条回答
  •  有刺的猬
    2020-11-29 19:26

    You can overcome this error in two simple ways

    First way

    using namespace std;
    include 
    // then you can use string class the normal way
    

    Second way

    // after including the class string in your cpp file as follows
    include 
    /*Now when you are using a string class you have to put **std::** before you write 
    string as follows*/
    std::string name; // a string declaration
    

提交回复
热议问题