-
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.
-
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;
-
change
iostream
to
iostream.h
-
what are you talking about bball that is a deprecated header file
[edit] can't type [/edit]
-
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)
-
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.
-
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