dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Cannot open include file: 'iostream.h

  1. #1
    Join Date
    Jan 2006
    Posts
    384

    Cannot open include file: 'iostream.h

    Hi,

    I am attempting to build Borland C++ 4.5 code on the VC++6.0 environment.

    For a set of files I attempt to compile after creating a workspace, I get the following set of errors-
    Code:
    fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
    fatal error C1083: Cannot open include file: 'string.h': No such file or directory
    fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    fatal error C1083: Cannot open include file: 'string.h': No such file or directory
    fatal error C1083: Cannot open include file: 'fstream.h': No such file or directory
    fatal error C1083:Cannot open include file: 'process.h': No such file or directory
    fatal error C1083: Cannot open include file: 'time.h': No such file or directory
    I have looked through the internet and as per the general solution to these sort of issues have done the following-

    Change #include <iostream.h> to #include <iostream>
    Add "using namespace std;" below the #include statements.

    Despite doing the above, I still get errors like -
    Code:
    fatal error C1083: Cannot open include file: 'iostream': No such file or directory
    The header files (both iostream.h and iostream) do exist in my machine and the path is specified in the Tools->Options->directories->Include files section.

    Can someone please share your suggestions on a possible solution ?

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Cannot open include file: 'iostream.h

    Check if "Ignore standard include path" is checked in project settings->C++->preprocessor
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Cannot open include file: 'iostream.h

    Quote Originally Posted by humble_learner
    The header files (both iostream.h and iostream) do exist in my machine and the path is specified in the Tools->Options->directories->Include files section.

    Can someone please share your suggestions on a possible solution ?
    First, do not use <iostream.h> even if it exists on your system. You should be using the standard header, <iostream>.

    Second, your include path settings are probably incorrect, and you should consult your compiler's documentation on how to set the compiler's include path correctly.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: Cannot open include file: 'iostream.h

    Normally these files should automatically be put into your path when you install your compiler. V6.0 is rather old though, you should consider an upgrade.

  5. #5
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: Cannot open include file: 'iostream.h

    dont forget to add using namespace std;
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  6. #6
    Join Date
    Jan 2006
    Posts
    384

    Re: Cannot open include file: 'iostream.h

    Hi,

    Thanks for your answers.

    The include path specified in the Tools/Options/Directories/Include is correct.

    I tried using #include<iostream> with "using namespace std" but the problem remained.

    The customer expects the porting from BC++ to VC++6.0 and hence have no other option but to user VC++6.0

    I checked the "ignore standard path" option in preprocessor settings but the problem remained.

  7. #7
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Cannot open include file: 'iostream.h

    I see no reason why this problem should come, is it possible to post the project here ?
    Regards,
    Ramkrishna Pawar

  8. #8
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: Cannot open include file: 'iostream.h

    Quote Originally Posted by jayender.vs
    dont forget to add using namespace std;
    as long as it's not in a header file, and it's often preferable to not add that in a source file either.

    If all you are using is cout and endl you can do:
    Code:
    using std::cout;
    using std::endl;
    And that would be reasonably acceptable in a header file in this instance as it's unlikely anyone would define cout and endl to mean anything else. (Don't apply this rule in general though).

    In a header file you can often include <iosfwd> rather than <iostream>.

  9. #9
    Join Date
    Jan 2006
    Posts
    384

    Resolved Re: Cannot open include file: 'iostream.h

    I am sorry for the oversight. Krishnaa's solution worked. I might have made some other mistake in my hurry to get things working.

    The errors were gone when I compiled once again after checking
    the [Ignore standard include paths ] check box in the C/C++ - Preprocessor option.

    What does checking of the option actually do to solve such errors ?

    Thanks for your time.

  10. #10
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Cannot open include file: 'iostream.h

    VC++ uses Environment variables like Include , Lib. These variables represent the paths for respective files.
    In your case these variables must have been modified/corrupted/removed, causing the problem reported.
    You can confirm this by looking at Environment Variables in System properties, Right click on "My Computer"->Advanced Tab ->Environment Variables button.

    See if include, lib, MSDevDir etc. are there and have proper values.

    You will have to reinstall(completly uninstall and install again) VC++ in order to get them back. You can manually assign values but reinstall is easy.
    Regards,
    Ramkrishna Pawar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)