Thread: Compilation problems?

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    3

    Compilation problems?

    I am new to programming and recently downloaded bloodshed devc++ (4.9.8.0). After testing to make sure it worked like I hoped, I copy and pasted this code from one of the tutorials on this website and compiled it:
    Code:
     #include <iostream.h> 
    int main() 
    { 
      int thisisanumber; 
      cout<<"Please enter a number:";
      cin>>thisisanumber; 
      cout<<"You entered: "<<thisisanumber; 
      return 0; 
    }
    However, this gave errors such as <In file included from C:/DEV-CPP/include/c++/backward/iostream.h> and <#warning This file includes at least one deprecated or antiquated header.>

    Then after searching for a solution from other posts I got it to work by changing the code to
    Code:
     #include <iostream> 
     using namespace std;
    int main() 
    { 
      int thisisanumber; 
      cout<<"Please enter a number:";
      cin>>thisisanumber; 
      cout<<"You entered: "<<thisisanumber; 
      return 0; 
    }
    This goes against everything I have learned thus far and was wondering why this works the way it does.

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    The tutorials on this site (and many others) are outdated. Your compiler is not outdated, it is up to date. You changed your code from using the old, non-standard header file <iostream.h>, to use the new, standard header file <iostream>.

    I think they are in the process of updating the tutorials, but until then, you will have to remember to use new headers instead of old ones. See the following page for more information:

    http://www.cplusplus.com/doc/ansi/hfiles.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. compilation problems with static data member
    By viral612 in forum C++ Programming
    Replies: 1
    Last Post: 08-13-2008, 06:55 AM
  2. vector compilation problems
    By Scarvenger in forum C++ Programming
    Replies: 3
    Last Post: 10-18-2007, 01:22 PM
  3. aspell compilation problems
    By bijie85 in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2006, 11:06 AM
  4. SDL compilation problems
    By OnionKnight in forum C Programming
    Replies: 7
    Last Post: 01-07-2006, 05:58 PM
  5. Compilation problems in Linux
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 08-19-2002, 02:01 PM