Error: left expression must be integral



  • Wenn ich dieses Programm compilieren will:

    #include<iostream>
    #include<string>
    using namespace std;
    
    string a = "Alecksander";
    
    main()
    {
      cout << "Hallo " << a << "!" << endl;
    }
    

    bekomme ich die folgenden Fehler:

    test.cpp(9): Error! E157: col(20) left expression must be integral
    test.cpp(9): Note! N717: col(20) left operand type is 'std::ostream (lvalue)'
    test.cpp(9): Note! N718: col(20) right operand type is 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> (lvalue)'
    Error: Compiler returned a bad status compiling 'test.cpp'

    Was ist da los?



  • [cpp]int main {
    //blah
    return 0;
    }[/cpp]
    mit den 2 Zusätzen läufts bei mir ohne Probleme.


Anmelden zum Antworten