mardi 17 avril 2018

Eclipse Oxygen C++ build error

Eclipse IDE for C/C++ Developers

Version: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

Hello! I am trying to get Eclipse Oxygen working on my 2017 MacBook Pro running High Sierra. I have the below code and there is an error when i try and initialize a string:

#include <iostream>
#include <string>

using namespace std;

int main() {

    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

    string userName{}; //this line throws the error saying: 
                       //expected ';' at end of declaration

    getline(cin, userName);

    cout << userName << endl;

    return 0;

}

I read somewhere that this is because the compiler is trying to read an older version of c++ whereas this is c++ 11. Does anyone know how to change the compiler settings to support c++ 11?

Thank you!

Aucun commentaire:

Enregistrer un commentaire