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 ...
- 07-26-2010 #1Just 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
- 07-26-2010 #2
try using iostream instead of iostream
Please disregard this post...I read the original post without my glasses..Make mine Arch Linux
- 07-26-2010 #3Just Joined!
- Join Date
- Jul 2010
- Posts
- 9
The include statements you mention are identical. Perhaps you meant something else?
- 07-27-2010 #4
Why dont you give it what it wants? Google will get you stream.h.
- 07-27-2010 #5Linux Newbie
- Join Date
- Mar 2010
- Posts
- 121
- 07-27-2010 #6Just Joined!
- Join Date
- Jul 2010
- Posts
- 9
Ok, slight progress; changing the include as follows:
Results in this compile error:Code:#include <iostream> /*#include <stream.h>*/ #include <math.h>
Which is an improvement over what I got yesterday: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]#
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
- 07-27-2010 #7Just Joined!
- Join Date
- Jul 2010
- Posts
- 9
Resolved!
Final include statements in the .cpp that was holding up compilation:
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.Code:#include <iostream> using namespace std; #include <cstdlib> /*#include <stream.h>*/ #include <math.h>
It worked but an opinion from a veteran developer is welcome.
Many thanks for the assist!
- 07-28-2010 #8Linux Newbie
- Join Date
- Mar 2010
- Posts
- 121
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.


Reply With Quote
