|
-
Jul 4th, 2001, 10:34 PM
#1
Thread Starter
Addicted Member
what the heck!? what's up with this?
Hey, can anyone tell me what is wrong with this code?
code:_______________________________
#include <iostream.h>
int main()
{
cout << "Hello World!\n";
return 0;
}
____________________________________
This SHOULD work shouldn't it? Anyways drop me a line right here people and let me know if you have any solutions. Thanks.
I'm just startin C++,
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 4th, 2001, 10:43 PM
#2
Fanatic Member
Looks fine to me. How doesn't it work?
Alcohol & calculus don't mix.
Never drink & derive.
-
Jul 4th, 2001, 10:53 PM
#3
Thread Starter
Addicted Member
The problem is this line here:
#include <iostream.h>
I don't think it's loading the file. Which then makes the program screw up on the"cout" function. I've had this problem once before but I can't remember what I did to fix it.
!@#$%&,
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 4th, 2001, 10:54 PM
#4
What compiler are you using? You may need to set the include directories yourself.
-
Jul 4th, 2001, 11:00 PM
#5
Thread Starter
Addicted Member
I'm using Turbo C++ Lite. It came with the book I bought on C++. I'll try reinstalling it and see if that changes anything.
BTW: How come none of the avatars are showing up? They just show the litle boxes with X's.
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 4th, 2001, 11:06 PM
#6
1) What version(3.0, 4.5?), if it's 4.5(win 3.11 version) check Options->Projects->Directories, and make sure the include directory is set to: c:\tcwin45\include (or something similar), and the lib directory is set to: c:\tcwin45\lib (or something similar).
2) Use vbforums.com rather than forums.vb-world.net
-
Jul 4th, 2001, 11:08 PM
#7
Thread Starter
Addicted Member
I got it to work now. Tell me though, does anyone know if unzipping (the compiler came in a *.zip) the compiler to the folder "c:\c++" cause any errors? When I unzipped it again in a different folder, "c:\tclite", the compiler worked just fine.
Thanks for what help there. was 
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 4th, 2001, 11:23 PM
#8
The compiler probably had problems recognising the plus signs... I always use cpp rather than c++ for folder names to avoid difficulties
-
Jul 4th, 2001, 11:38 PM
#9
Fanatic Member
Alcohol & calculus don't mix.
Never drink & derive.
-
Jul 4th, 2001, 11:43 PM
#10
When using forums.vb-world.net the avatars and file attachments don't work.
-
Jul 5th, 2001, 12:08 AM
#11
Thread Starter
Addicted Member
oh
OK then, I'll just find the right address then to the vb forums. Shouldn't be too hard.
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 5th, 2001, 12:12 AM
#12
Thread Starter
Addicted Member
Hey, does anyone know where I can find a decent compiler for free?
BTW: Still haven't found the correct address for the forums.
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
-
Jul 5th, 2001, 12:30 AM
#13
it's http://www.vbforums.com
A pretty good compiler called Dev-C++ can be found at BloodShed.net
-
Jul 5th, 2001, 05:24 AM
#14
Monday Morning Lunatic
The Borland free command line tools (BCC version 5.5 I think) are available from www.borland.com - although you have to register for their community first.
PS: You should always now use <iostream> rather than <iostream.h>
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 5th, 2001, 11:12 AM
#15
Guru
In Standard C++, the header file iostream.h is not defined. A compiler doesn't have to have this header file to be compliant with the standard. Instead, there is iostream, and the namespace std.
Code:
// Instead of:
#include <iostream.h>
// You should use:
#include <iostream>
using namespace std;
// The rest of the code is the same:
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
Oh, and also, instead of using "\n" it is common to use "endl", since "endl" also flushes the stream and "\n" doesn't.
There is an online compiler at http://www.comeaucomputing.com/tryitout/ which compiles (but does not link) your code. It's good for checking whether your code complies to the C++ standard. Great for finding all kinds of silly bugs in the VC++ compiler, and there are many
-
Jul 5th, 2001, 11:34 AM
#16
Mike: While he's using TC++ Lite, he can't use <iostream> Borland made TC++4.5 non-standard... there's no standard library  It's mainly 'cause TC++ is a learning tool, and it's easier to learn w/o having to fool with the standard library(I guess)....
-
Jul 5th, 2001, 02:08 PM
#17
Monday Morning Lunatic
So why is it easier if it makes it totally non-compatible, meaning that you end up having to relearn everything when you get a real compiler?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 5th, 2001, 03:44 PM
#18
I don't know... the "I guess" in parenthesis was said to indicate that that's what I think Borland thought when making the compiler.. *geeeeesh*... Anyway, I do think it's retarded... I had such a hard time learning *** the std namespace was for(I learned a lot of stuff using TC++4.5 in my computer science class)
-
Jul 5th, 2001, 09:56 PM
#19
Thread Starter
Addicted Member
Hey slow down guys! I don't know what yer talkin about. Let me read the book first before you guys start talking about "***" are std namespaces. Anyways thanks for the link to the vb forums Dennis. Heh, I didn't completely read your post above I was in a hurry last night typing out those posts. Anyways Dennis I don't think I'll stay with TC++ Lite for long because it won't let me make my own *.exe files. I might stick with it through the book or download one of the suggestions above.
Thanks everyone for the help. I appreciate the quick responses.
Drewski
I see said the blind man as he spat into the wind.
It all comes back to me now!
A.D.T.'s VB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|