Results 1 to 3 of 3
ok here is my code:
Code:
#include <iostream>
using namespace std;
int main();
{
cout <<"Hello World!\n";
return 0;
}
then i try to compile with g++ with this command:
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-01-2005 #1Linux Newbie
- Join Date
- Mar 2005
- Location
- California!
- Posts
- 159
New to c++, about to pull hair out! can't compile simple helloworld!
ok here is my code:
then i try to compile with g++ with this command:Code:#include <iostream> using namespace std; int main(); { cout <<"Hello World!\n"; return 0; }
to which i get an error of:Code:g++ hello.cpp -o hello
this will not compile with visual studio either, although i get a different error.Code:hello.cpp:5: error: expected unqualified-id before '{' token
thoughts?Registered Linux User # 392752
• \"pr0n\": An anagram of \"porn,\" possibly indicating the use of pornography.
- 10-01-2005 #2
remove the semicolon ( ; ) from the end of the main() declaration, and it'll all work...
Linux user #126863 - see http://linuxcounter.net/
- 10-01-2005 #3Linux Newbie
- Join Date
- Mar 2005
- Location
- California!
- Posts
- 159
WOW it was a typo in my book! OMG now i gotta get a new book!
thanks manRegistered Linux User # 392752
• \"pr0n\": An anagram of \"porn,\" possibly indicating the use of pornography.


Reply With Quote
