Search code examples
c++shellvariablesistream

compilation error with iostream usage for console program


I wanted to make an C++ programm to learn more about terminal input an variables, but I get this error message every time I try to compile it:

var.cpp: In Funktion »int main()«:
var.cpp:16:8: Fehler: Anweisung kann die Adresse der überladenen Funktion nicht auflösen

Here is my code:

#include <iostream>

using namespace std;

int main(void)
{
    int z;
    z = 1;
    cout << z << endl;

    int z2 = 7;

    int I;
    cin >> I;

    cin.get;
    return 0;
}

Solution

  • I am somewhat guessing since I don't understand German(?), but cin.get is a function, so you need to add the parenthesis:

    cin.get();