Menu

cout error

Devil
2008-09-30
2012-09-26
  • Devil

    Devil - 2008-09-30

    even the simplest programs give me odd errors
    the program :

    include<iostream>

    int main()
    {
    cout<<"i rock!\n";
    }

    Error Log:
    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "D:\Documents and Settings\Devil\Desktop\5.cpp" -o "D:\Documents and Settings\Devil\Desktop\5.exe" -ansi -traditional-cpp -pg -g3 -I"D:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"D:\Dev-Cpp\include\c++\3.4.2\backward" -I"D:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"D:\Dev-Cpp\include\c++\3.4.2" -I"D:\Dev-Cpp\include" -L"D:\Dev-Cpp\lib" -lgmon -pg -g3
    D:\Documents and Settings\Devil\Desktop\5.cpp: In function int main()': D:\Documents and Settings\Devil\Desktop\5.cpp:4: error:cout' undeclared (first use this function)
    D:\Documents and Settings\Devil\Desktop\5.cpp:4: error: (Each undeclared identifier is reported only once for each function it appears in.)

    Execution terminated

     
    • Juan Carlos Moreno Henao

      Hellow, kevin thedevil.

      You cannot write simply cout, because Dev-C++ thinks cout is a variable.You must write the program thus:

      include<iostream>

      include <conio.h>

      int main()
      {
      std::cout<<"i rock!\n";
      getch();
      }

      or thus:

      include<iostream>

      include <conio.h>

      using namespace std;

      int main()
      {
      cout<<"i rock!\n";
      getch();
      }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.