Thread: <iostream> or <iostream.h> ??

  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
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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..

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

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Welcome..Abbas..
    C++ koto'ta sekha holo ? C'er theke bhalo lagche na baje?

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, 07: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