C NOOB

#include <stdio.h>

mail()

{

printf("hello world/n");

}

....Thats straight out of a book i just ordered and everytime i hit build solution like it tells me to this comes up....

LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

C:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\Debug\hello.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at "file://c:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\hello\Debug\BuildLog.htm"

hello - 2 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Anyone know what im doing wrong

Im also using "win 32 Console Application" if that helps



Re: Visual C++ Express Edition LNK2019 Error-Please help

orcmid

C NOOB wrote:

#include <stdio.h>

mail()

{

printf("hello world/n");

}

Try main() and double check that against the book. If it says mail(), burn it. If they can't get the easy stuff right ... and the book seems a little old too.

Also, use Visual C++ 2005 Express Edition menu Help | Search | and look up main() for a little more about it. The one on C++ main function is a good place to start. It won't all make sense right away.

- Dennis






Re: Visual C++ Express Edition LNK2019 Error-Please help

C NOOB

Still got the same two errors "Lnk2019" and "Lnk1120"...

Linking...

LIBCMT.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup

C:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\Debug\hello.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at "file://c:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\hello\Debug\BuildLog.htm"

hello - 2 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





Re: Visual C++ Express Edition LNK2019 Error-Please help

orcmid

C NOOB wrote:

Still got the same two errors "Lnk2019" and "Lnk1120"...

Linking...

LIBCMT.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup

C:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\Debug\hello.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at "file://c:\Documents and Settings\Brett\My Documents\Visual Studio 2005\Projects\hello\hello\Debug\BuildLog.htm"

hello - 2 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

There's one error followed by a summary error saying the other errors are preventing the link from succeeding.

It looks like your settings are wrong. What is the name of your source program Is it hello.c or hello.cpp

I would start a completely new project in Visual C++ 2005 Express Edition. In the VC++ window, select File | New | Project ...

and in the New Project window select Project types: General and Templates: Empty Project

At the bottom, make sure there is no check in the box at "Create directory for solution"

Name your project something different, such as "Hello2". (I am doing this right now.)

Once you have this new empty project in the Solution Explorer, there will be a Project entry in the top menu.

Select Project | Add New Item ...

In the Add New Item - Hello2 dialog window, select Categories: Code and Templates: C++ File (.cpp).

In the name field, enter "Hello2.c". Be sure to specify .c so that Visual C++ will compile it as a C Language program.

Enter your Hello World program in the blank document that is opened for Hello2.c.

I did that, with the correct name for "main" and it compiled find when I selected Build | Build Solution.

Then when I select Debug | Start without Debugging

it runs fine. There is an error in your output string, but I will let you find and fix that.

You should use this procedure for all of your initial exercises and practice. For most experiments in C Language, you won't need to do any more than this, even when you start using multiple files and header files to compose more elaborate programs.

Take small steps, as you are doing, and build your capacity to find your own mistakes, trust the error messages, and learn how to find out information in books and in the built-in and on-line MSDN Help.

Enjoy,

- Dennis