<iostream> or <iostream.h> ??

This is a discussion on <iostream> or <iostream.h> ?? within the C++ Programming forums, part of the General Programming Boards category; when i compile a c++ program using <iostream.h> i get the following warning C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32.4. 5\..\..\..\..\include\c++.4.5\backward\backward_ warning.h|32|warning: #warning This file ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    50

    Exclamation <iostream> or <iostream.h> ??

    when i compile a c++ program using <iostream.h> i get the following warning

    C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4. 5\..\..\..\..\include\c++\3.4.5\backward\backward_ warning.h|32|warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.|
    ||=== Build finished: 0 errors, 1 warnings ===|

    but when i replace it by <iostream> it shows the error:

    C:\Documents and Settings\Machine\Desktop\Untitled1.cpp||In function `int main()':|
    C:\Documents and Settings\Machine\Desktop\Untitled1.cpp|5|error: `cout' was not declared in this scope|
    C:\Documents and Settings\Machine\Desktop\Untitled1.cpp|5|error: `endl' was not declared in this scope|
    ||=== Build finished: 2 errors, 0 warnings ===|

    i am using codeblocks. what should i do?
    to be more specific can anyone tell why the compiler cant accept <iostream> though it suggests to do so.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    It works with <iostream>

    I'm 100% sure that you haven't put the line..
    Code:
    using namespace std;
    before using the standard library objects..
    The other option is to use
    Code:
    std::cout
    Code:
    std::cin
    etc ..everywhere..
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    50
    ya that was the fault, lots of thanks..

  4. #4
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Welcome..Abbas..
    C++ koto'ta sekha holo ? C'er theke bhalo lagche na baje?
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. iostream
    By Wynter in forum C++ Programming
    Replies: 11
    Last Post: 04-21-2004, 09:49 AM
  2. iostream vs iostream.h
    By LegendsEnd in forum C++ Programming
    Replies: 16
    Last Post: 03-27-2004, 06:14 PM
  3. <iostream>
    By Ivan! in forum C++ Programming
    Replies: 10
    Last Post: 05-24-2003, 08:04 PM
  4. iostream or iostream.h?
    By serruya in forum C++ Programming
    Replies: 15
    Last Post: 05-05-2003, 07:41 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21