Hello World Problem

I've just finished installing the Borland C++ 5.5.1 version. Now, the problem is that, my hello world program (the very first thing the I tried for this version) doesnt work.

I just wonder what part I screwed up.
here it is:

1
2
3
4
5
6
7
8
9
10
// bcc1.cpp
#include<iostream>
#include<conio>

int main()
{
cout<<"Hello World from BCC 5.5"<<endl;

getch();
}


When I tried to run it, it gives me these errors:

Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
bccl.cpp:
Error E2209 bccl.cpp 2: Unable to open include file 'iostream'
Error E2282 bccl.cpp 3: Namespace name expected
Error E2451 bccl.cpp 7: Undefined symbol 'cout' in function main()
Error E2451 bccl.cpp 7: Undefined symbol 'endl' in function main()
*** 4 errors in Compile ***

What am I doing wrong? Could anyone shed some light?
Everything about this seems too much for me.

Try this.

1
2
3
4
5
6
7
#include <iostream>
using namespace std;

int main() {
 cout<<"Hello World from BCC 5.5" << endl;
return 0; 
}
closed account (z05DSL3A)
I think with the age of Borland C++ 5.5.1, you have to use the 'old' header files, such as #include<iostream.h> .

You may find it easier to get hold of a newer compiler.
Also, (this was the case for VS 6) cout was in the global namespace, in iostream.h.
@ lacviet:

it still doesnt work! huhuhuhu...

guys, is it possible that these errors happens because I have installed it incorrectly at some point? if that's so, it wouldnt have work in the first place, right?

oh my gosh! this is not good...
Yep. Try it with the #include <iostream.h> as Grey Wolf suggested. Or perhaps get an IDE that is more users friendly like Dev, or MinGW. I uses MinGW, and the authors was kind enough to include all the library ^_^. Just make life easier for us noob. Your error indicated that it couldn't find the file "iostream". So maybe it just lacking that file. Try.

http://www.parinyasoft.com/download.html

1
2
3
4
5
6
7
#include <iostream.h>
using namespace std;

int main() {
 cout<<"Hello World from BCC 5.5" << endl;
return 0; 
}
Last edited on
yeah... i already tried it with <iostream.h> but is still didnt work...

i had no plans in using that Borland C++ 5.5 again... it kinda hit my nerves..,
im going to try a new one,.. thanks a lot, though! i really appreciate it... : )
Remove the namespace line, and you should be ok.
hmmmp... still not working :(

i guess there's something wrong with the software...
Is Borland 5.5.1 a command-line compiler? You might need to include the switches for the include and library file directories in your command prompt entry for compilation.

I suggest downloading Bloodshed Dev-C++ and installing that. It is an Integrated Developing Environment and sets itself up to see it's required include and library directories. You should have no problem with that program as was revised by LacViet.

There are others that work equally well, but I am a fan of Dev-C++.

~psault
Topic archived. No new replies allowed.