-
iostream.h help???
Im a newbie to the c, c++ enviroment, but im actually coming along pretty well.
I d/led borland 5.5 free compiler, and i also have djgpp!
I was able to make a simple prog using this code:
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
'and it works.
Now i went to a lot of websites with beginning tutorials that did this same prog but in a different way:
#include <iostream.h>
int main()
{
cout << "Hello World!";
return 0;
}
'This doesn't work for me!!
And a lot of tutorials use this method, i want to learn more , but i can't follow any tutorials since they use this method.
If n e 1 can hlp, its much appreciated.
If this is the wrong forum, plz forgive me!
lata'
-
reply
The syntax looks correct. What errors do you get? Assuming you have iostream.h and its components that code should work...
And this is definitely the right forum ;)
-
The first example is "old" C style I/O the second is "new" C++ stream I/O. Both are useful, (but avoid mixing them in the same program on the same I/O channel!!!).
Change the second to this...
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!"<<endl;
return 0;
}
... and see how your compiler likes it.
-
hmmm, nope!
Well my computer didn't like that code snippet, and i have iostream.h.
Whenever i try to use the <iostream.h> and COUT, and try to compile it says no such file or directory!!!
maybe its in the wrong dir, or do i have to put it in a certain area?
thx!
-
Did you have it just like adrian's example? With no 'h' on the iostream?
-
What compiler are you using? It may be C only.
-Prelude
-
>>> It may be C only.
Well, he said he was using B5.5. I know that is B's current C++ compiler, BUT, of course, it may be configured for C. Do you know if that is possible with that compiler?
-
yep...
Yes, I took the .h out of <iostream.h> ---> <iostream>.....
And i have djgpp(Is that C only?)
And Borland 5.5 C++ Builder, which should be able to handle the iostream.h, right?
-
>>> which should be able to handle the iostream.h,
Any C++ compiler should be able to handle a header in xxx.h format, it is, however, not the currently preferred way of doing it. You should be using the newer form, (without the ".h"), and then specifying the namespace(s) you want to use. (Don't worry about namespaces just now, just make sure you include the std namespace, otherwise your compiler won't be able to find anything).
So your telling us that the code I gave you, (EXACTLY the code I gave you), will not compile with either of your compilers? It compiles and runs just fine with VC++.
-
dammn...
alright, now i can't compile a prog using borland...
Now it says ya hav to put a line in the autoexec...
which i hav.
this is it, but does it look right.
PATH=%PATH%;"C:\Borland\BCC55\bin"
Bcoz when my computer restarts it says too many parameters.
??
-
GOT IT!!!!!
Finally, I got the bcc32 working and your code snippet works fine!!!!!! Thx for every1ns hlp, much appreciated!
May this forum live forever and ever!!!
lata'