Lnk 2019: Unresolved external symbol

I recently decided to take up C++ on my own as sort of a hobby. I got a PDF file called "Teaching yourself C++ in 21 days" , and sadly I am still stuck on the first program, the "Hello world" exercise.

Here is my code (using Microsoft Visual C++ 2010 express):
1.#include <iostream>
2.using namespace std;
3.
4.int main ()
5.{
6.cout <<"Hello World!";
7. return 0;
8.}

I keep getting the error LNK 2019: Unresolved external symbol _WinMain@16 referenced in the function ___tmainCRTStartup

I have read many posts on this subject but due to my lack of programming knowledge most information is just a big jumble of words to me. I understand from all the other same error questions that I must add some sort of .lib file to the project settings and I have found the appropriate window, but I do not know exactly what I'm supposed to add and I haven't been able to figure it out for about two hours, so any help would be appreciated!
closed account (zb0S216C)
remas wrote:
"Teaching yourself C++ in 21 days"

Drop the book and back away slowly.

Any book that claims to teach something in N days is bound to fall short of thoroughness, since they'll drop information so that they can make the 21 day time frame. I recommend getting a proper book, such as "C++ Primer", "Absolute C++", "The C++ Programming Language", or "Principles and Practice Using C++".

As for your error, WinMain() is the entry-point for a Windows application. For console applications, you need main(). You can set up a console application by following this walkthrough: http://msdn.microsoft.com/en-us/library/ms235629.aspx

Wazzak
The book is not just bad because of its title (it could get worse, such as the abridged version which is called "Teach Yourself C++ in 24 hours"), it's bad because of its contents. It teaches you very poor style which can take you a long time to get away from.
Last edited on
Thank you for your advice, I found a PDF of C++ Primer and I'm going to be learning from that from now on. Also thank you for the walk through, I finally got my first Program to work :D
Topic archived. No new replies allowed.