error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

前端 未结 1 1153
北荒
北荒 2020-11-27 20:38

Here\'s my code, how do I fix this error?

#include \"stdafx.h\"
#include 

using namespace std;

int main()
{
    string title = \"THE WORLD          


        
1条回答
  •  清歌不尽
    2020-11-27 21:44

    You forgot to #include

    using std::string without including it's header works on some compilers that indirectly import parts of into their 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<<.

    0 讨论(0)
提交回复
热议问题