|
-
Sep 10th, 2001, 03:12 AM
#1
Thread Starter
Fanatic Member
Hello World
This code fails 
Code:
#include <iostream.h>
int main ()
{
cout << "Hello World!";
return 0;
}
Errors are:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/fu.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
What am I doing wrongly?
-
Sep 10th, 2001, 03:20 AM
#2
Frenzied Member
Your project is a Windows Application. You want a Win32 Console Application. So make a new project
Harry.
"From one thing, know ten thousand things."
-
Sep 10th, 2001, 03:21 AM
#3
Thread Starter
Fanatic Member
To create it I just did:
new project --> win 32 console app
Then from file view, right clicked to add a new cpp file.
In the cpp file I added the code then clicked ! to compile it and it bombed.
Can someone tell me why?
-
Sep 10th, 2001, 03:23 AM
#4
Thread Starter
Fanatic Member
Originally posted by HarryW
Your project is a Windows Application. You want a Win32 Console Application. So make a new project
I just tried it again and it worked. I must have chosen something other than console app , thanks for the help.
-
Sep 10th, 2001, 04:14 AM
#5
Frenzied Member
Ah, that's good, I was about to be very confused
Harry.
"From one thing, know ten thousand things."
-
Sep 10th, 2001, 12:19 PM
#6
Monday Morning Lunatic
Code:
#include <iostream.h>
int main() {
cout << "Hello World!";
return 0;
}
Pity iostream.h is deprecated 
Code:
#include <iostream>
using std::cout;
using std::endl;
int main() {
cout << "Hello World!" << endl;
return 0;
}
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
-
Sep 10th, 2001, 03:08 PM
#7
PowerPoster
Originally posted by parksie
Code:
#include <iostream.h>
int main() {
cout << "Hello World!";
return 0;
}
Pity iostream.h is deprecated 
Code:
#include <iostream>
using std::cout;
using std::endl;
int main() {
cout << "Hello World!" << endl;
return 0;
}
You sometime try to confuse by using...
-
Sep 10th, 2001, 03:40 PM
#8
If you require many of iostream's routine, then you can just include the whole namespace.
Code:
using namespace std;
-
Sep 12th, 2001, 04:04 PM
#9
Fanatic Member
Iam sure this will work
/* This program says hello world*/
#Include<<iostream.h>>
voidmain(void)
{
cout<<"Hello World!";
}
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 12th, 2001, 04:07 PM
#10
Monday Morning Lunatic
1. iostream, not iostream.h
2. void main is incorrect. It should be int main. However, the parameters are optional so using void is okay there. You'll need a return statement.
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
-
Sep 12th, 2001, 04:18 PM
#11
Frenzied Member
It will works that way, but it will be right if you follow parksie's suggestions.
change
#Include<<iostream.h>>
to
#include <iostream.h>
-
Sep 12th, 2001, 04:25 PM
#12
Frenzied Member
This is right
Code:
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout<<"Hello World!"<<endl;
return 0;
}
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
|