Find the answer to your Linux question:
Results 1 to 8 of 8
Phase II of my ongoing drama to get some legacy C++ code running. As seen in a related post I'm not a developer, but a sysadmin. Again, for some reason ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    9

    C++ error: stream.h: No such file or directory


    Phase II of my ongoing drama to get some legacy C++ code running. As seen in a related post I'm not a developer, but a sysadmin.

    Again, for some reason now matter how I format my post, I get this msg:
    "You are only allowed to post URLs to other sites after you have made 15 posts or more."
    (sigh) see attached file
    Attached Files Attached Files

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    try using iostream instead of iostream

    Please disregard this post...I read the original post without my glasses..
    Make mine Arch Linux

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    9
    The include statements you mention are identical. Perhaps you meant something else?

  4. #4
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    877
    Why dont you give it what it wants? Google will get you stream.h.

  5. #5
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    152
    Quote Originally Posted by kdwoell View Post
    The include statements you mention are identical. Perhaps you meant something else?
    What he meant was to use "#include <iostream>" instead of "#include <stream.h>".

  6. #6
    Just Joined!
    Join Date
    Jul 2010
    Posts
    9
    Ok, slight progress; changing the include as follows:

    Code:
    #include <iostream>
    
    /*#include <stream.h>*/
    #include <math.h>
    Results in this compile error:
    Code:
    [root@localhost up]# make 
    g++ -DHAVE_CONFIG_H -Wall -g -I. -c atmosphere.cpp -o atmosphere.o
    atmosphere.cpp: In function ‘void lower_atmosphere(double, double*, double*, double*)’:
    atmosphere.cpp:134: error: ‘cerr’ was not declared in this scope
    atmosphere.cpp:134: error: ‘endl’ was not declared in this scope
    atmosphere.cpp:136: error: ‘exit’ was not declared in this scope
    make: *** [atmosphere.o] Error 1
    [root@localhost up]#
    Which is an improvement over what I got yesterday:
    Code:
    g++ -DHAVE_CONFIG_H -Wall -g -I. -c atmosphere.cpp -o atmosphere.o
    atmosphere.cpp:23:20: error: stream.h: No such file or directory
    atmosphere.cpp: In function ‘void lower_atmosphere(double, double*, double*, double*)’:
    atmosphere.cpp:133: error: ‘cerr’ was not declared in this scope
    atmosphere.cpp:133: error: ‘endl’ was not declared in this scope
    atmosphere.cpp:135: error: ‘exit’ was not declared in this scope
    make: *** [atmosphere.o] Error 1

  7. #7
    Just Joined!
    Join Date
    Jul 2010
    Posts
    9

    Resolved!

    Final include statements in the .cpp that was holding up compilation:
    Code:
    #include <iostream>
    using namespace std;
    #include <cstdlib>
    /*#include <stream.h>*/
    #include <math.h>
    Apparently from another forum #include <iostream> must be referenced to use the exit function in gcc 3.4., and iostream includes cstdlib. However in gcc 4.3 this dependency has been removed so you need to #include <cstdlib> to use exit.

    It worked but an opinion from a veteran developer is welcome.

    Many thanks for the assist!

  8. #8
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    152
    Quote Originally Posted by kdwoell View Post
    It worked but an opinion from a veteran developer is welcome.
    I'd by no means call myself a "veteran", but what are you after an opinion on?

    If your only problem was some mis-included files and a lack of "using namespace std", then doing what you did to get the code to compile is perfectly fine. Doing these sorts of things won't affect runtime behaviour, if that's what you're asking - they'll only allow the code to be compiled.

Posting Permissions

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