Thread: Compiler not working...

  1. #1
    Geo Geo Geo-Fry
    Join Date
    Feb 2003

    Compiler not working...

    I am just starting to learn C++, and I have downloaded Dev-C++ v 4.9.7 and when I go to File > New > Project and then pick Counsle Application (like the tutorial on this site says to) everything works fine. Then I put the code in, which at this point is:

    #include <iostream.h>
    int main()
    int thisisanumber;
    cout<<"Please enter a number:";
    cout<<"You entered: "<<thisisanumber;
    return 0;

    and when I go to Compile it has a bunch of error messages like:

    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\"
    Executing make...
    make.exe -f "C:\Dev-Cpp\" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include"
    main.cpp:1:22: iostream.h: No such file or directory
    main.cpp: In function `int main()':
    main.cpp:9: `cout' undeclared (first use this function)
    main.cpp:9: (Each undeclared identifier is reported only once for each function
    it appears in.)
    main.cpp:11: `cin' undeclared (first use this function)
    make.exe: *** [main.o] Error 1
    Execution terminated

    And if I try to go to Run it says it's not compiled. What should I do, I tried changing the code, picking a new thing (ie New > Project and then one of the other choices) and even reinstalling the application. Someone please help me.

  2. #2
    Is 4.9.7 a non-BETA version? if not then download the lastest non-BETA version because all of the betas are very buggy right now.

    Try including iostream (leave off the extention). And make sure to declare what namespace cout and cin belong to. try this code-
    #include <iostream>
    using namespace std;
    int main()
         int number;
         cout << "Please enter a number: ";
         cin >> number;
         cout << "You entered: " << number;
         return 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. gcc compiler not working in windows vista
    By taurus in forum C Programming
    Replies: 1
    Last Post: 03-05-2009, 01:11 AM
  3. free 64-bit C++ compiler on Windows
    By cyberfish in forum C++ Programming
    Replies: 20
    Last Post: 11-04-2008, 12:14 AM
  4. lcc win32 compiler download problems
    By GanglyLamb in forum A Brief History of
    Replies: 5
    Last Post: 08-01-2004, 07:39 PM
  5. Compiler Design... Anyone That Can Help!
    By ComputerNerd888 in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2003, 09:48 AM