Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borland C++ 5.02

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi Guys! When run the code below in my Borland C++ 5.02 i get the error msg "Must use C++ for the type iostream." But i am using C++. My frens says theres an option that allows u to either compile in C or C++. If that is true, where do i change it so that i can compile the following program.

#include <iostream>

int main()
{ int i = 10, j=20;
int k = (i+j)/2;
std::cout << &quot;i is &quot; <<i
<<&quot; and j is &quot; << j << std::endl;
std::cout << &quot;average is &quot;<< k
<< std::endl;
return 0;

}
 
It runs in my mind that you shouldn't use the std:: with 5.02. It has something to do with how the standard was implimented in that version (I think). Try removing it from your program and recompiling, it should work then.
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
I think you should in compiller settings set C++ node instead of C node. Also use extension cpp for C++ files. John Fill
1c.bmp


ivfmd@mail.md
 
Errm..wat shld i use then to achieve the desired results if std:: is not supported? Is Borland C++ 5.02 the latest version? if it is then y is std:: not supported. if it is not the latest version, then wat is the latest version and does it support std::?
 
The latest version is 5.5. It is available for free from . You can also download a debugger for it, too. At the time 5.02 was written, the C++ standard was still being debated and DOS was still in use.

James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
By the way, I just tested your program with 5.5 and it compiled and ran just fine. :)
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
hi there,

just try to change the node type from c to cpp as well as extension of ur source file must be *.cpp n it will work fine.

ComputerJin
 
A thought, in the mist of a dawn!!

I think that if the compiler demands that the file has a specific extension, then there is something wrong here!! Come one, it's just a plain text file!!
Sure, perhaps the compiler more easily senses whether it is a C++ or C program but I still think it’s a bit awkward!!
My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top