Fehler im Programm, sagt: "Diese Datei erfordert compiler und Bibliothek-Unterstützung des ISO C++ 2011 standard"

Dieses Programm ermöglicht dem Benutzer, geben Sie Aufwendungen für jede jahreszeit und zeigt dann die Werte und dann die Gesamtkosten am unteren Rand. Es ist mir dieser Fehler jedoch

In file included from /usr/include/c++/4.8.3/array:35:0,
                 from main.cpp:2:
/usr/include/c++/4.8.3/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \

Wie kann ich dieses Problem beheben?

#include <iostream>
#include <array>
#include <string>

//constant data
const int Seasons = 4;
const std::array<std::string, Seasons> Snames =
    {"Spring", "Summer", "Fall", "Winter"};

//function to modify array object
void fill(std::array<double, Seasons> * pa);
//function that uses array object without modifying it
void show(std::array<double, Seasons> da);

int main()
{
    std::array<double, Seasons> expenses;
    fill(&expenses);
    show(expenses);
    return 0;
}

void fill(std::array<double, Seasons> * pa)
{
    using namespace std;
    for (int i = 0; i < Seasons; i++)
    {
        cout << "Enter " << Snames[i] << " expenses: ";
        cin >> (*pa)[i];
    }
}

void show(std::array<double, Seasons> da)
{
    using namespace std;
    double total = 0.0;
    cout << "\nEXPENSES\n";
    for (int i = 0; i < Seasons; i++)
    {
        cout << Snames[i] << ": $" << da[i] << endl;
        total += da[i];
    }

cout << "Total Expenses: $" << total << endl;
}
"Diese Unterstützung derzeit noch experimentell, und muss aktiviert werden, mit -std=c++11 oder -std=gnu++11 compiler-Optionen." Tun Sie dies.

InformationsquelleAutor B. Wilson | 2016-04-02

Schreibe einen Kommentar