Thread: small error need help

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    1

    small error need help

    I am just starting out with c++ and need some help. When i try to compile this:

    #include <iostream>

    int main()
    {
    cout <<"HEY, you, I'm alive! Oh, and Hello World!";
    return 0;
    }

    with borland c++ 5.5 i get these 2 errors:
    1: unable to open include file 'iostream'
    5: undefined symbol 'cout' in function main()

    thx in advance.

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    sounds like your path to your header files is wrong
    and for the code put this at the top when you get the path right
    Code:
    #include <iostream>
    using std::cout;
    Woop?

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    67
    change

    iostream

    to

    iostream.h

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    what are you talking about bball that is a deprecated header file
    [edit] can't type [/edit]
    Last edited by prog-bman; 07-28-2004 at 06:31 PM.
    Woop?

  5. #5
    meow nbk's Avatar
    Join Date
    Jul 2004
    Posts
    45
    iostream.h is a deprecated(antiquated, which is used to compile older c++ programs) header file - in 1998(?) there were new standards, and all c++ header files lose the .h (c headers add a 'c' to the beginning of the header and lose the .h), and now all C++ commands in the headers are in the std namespace(so, if you're using more commands that just cout, you could type using namespace std instead of using std::command)
    Last edited by nbk; 07-28-2004 at 06:44 PM.

  6. #6
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    Actually, deprecated specifically means that the header file is standard, but it might be removed from the standard in the future, so you are encouraged to use the new headers. The C Runtime library headers with the .h are deprecated. The old C++ libraries like iostream.h are not deprecated, because that would mean that they are standard. They are just old (antiquated) and non-standard.

    It is certainly possible that your compiler does not recognize the new, standard headers like iostream. In that case, you will have to use <iostream.h>, or better yet, get a newer compiler. If that compiler is supposed to support the new headers, then the problem might be your installation or setup like prog-bman said originally.

  7. #7
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    BC 5.5 does support <iostream> so you just need to check your bcc32.cfg
    it should have something that resembles this -I"C:\BCC55\INCLUDE
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to split long programe in small files
    By umeshjaviya in forum C Programming
    Replies: 11
    Last Post: 04-15-2008, 02:45 AM
  2. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 02:05 AM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. yhatzee, small straight
    By uglyjack in forum C++ Programming
    Replies: 2
    Last Post: 06-13-2002, 03:09 AM
  5. Small app ideas
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-15-2002, 08:57 PM