I've recently been told that Windows Visual Studio is one of the best IDEs for C++ development, so I decided to get it, but it's my first time using it and I'm already getting a weird error. The following code:
#include "stdafx.h"
#include "iostream"
#include "string"
using namespace std;
class Player {
public:
string name = "Player";
};
int main() {
cout << "Works";
return 0;
}
returns error C2864: 'Player::name' : only static const integral data members can be initialized within a class. What is wrong? This code compiled in Codeblocks IDE. Please explain to me what is wrong I don't understand.