Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-29-2003, 09:47 PM   PM User | #1
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
C++, hello world?

PHP Code:
#include <iostream>

int main()
{
    
std::cout << "Hello world!\n";
    return 
0;

What's the problem with this code? It's driving me insane I try to compile it and I get the following error

Quote:
c:/cpp/hello.cpp:7:2: Warning: no newline at end of file
Line 7 char 2 I guess that is, line 7 is the }
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-29-2003, 09:51 PM   PM User | #2
Josh Campbell
New Coder

 
Join Date: Jun 2002
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Josh Campbell is an unknown quantity at this point
For some reason you need a newline at the end of file to compile. Not an error, just a warning. Compilers are picky. Just press enter after the closing brace.
Josh Campbell is offline   Reply With Quote
Old 03-29-2003, 09:53 PM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
That's the most stupid thing I've ever known lol Spent ages trying to figure it out too

ta for that
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-29-2003, 09:59 PM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Bah, ok it's compiled into an *.exe now, but if I try to run it from dos, it's too big to fit in memory? so when I try to run it by clicking on the *.exe, it shows a popup saying that it's not a valid win32 file Is this just my compiler trying to wind me up and playing silly buggers with me, or is c++ not meant to work on windows?
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-29-2003, 11:11 PM   PM User | #5
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
nm, fixed it. I needed the windows.h file thingy
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:28 PM.


Advertisement
Log in to turn off these ads.