Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LNK2019: unresolved external symbol _WinMain@16

481 views
Skip to first unread message

pete

unread,
Apr 4, 2009, 6:19:53 AM4/4/09
to
Hello folks --

First time I've seen this link error. Trying (VC6) to build hello.c:

#include <stdio.h>
int main (int argc, char **argv) {
printf("hello, world\n");
}

gives this error:

1>------ Build started: Project: hello-world, Configuration: Debug
Win32 ------
1>Compiling manifest to resources...
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function ___tmainCRTStartup
1>Debug\hello-world.exe : fatal error LNK1120: 1 unresolved externals

I must have changed something somewhere in VC6 defaults to give this
crazy-seeming error, but what?

Can someone please give me a clue as to what's going on?

Thanks!

-- Pete

pete

unread,
Apr 4, 2009, 6:34:14 AM4/4/09
to
Never mind. There's something badly wrong with my dev env, I'll
reinstall everything. Thanks anyway.

-- Pete

pete

unread,
Apr 4, 2009, 11:20:31 AM4/4/09
to
On Apr 4, 6:34 am, pete <pete...@yahoo.com> wrote:
> Never mind. There's something badly wrong with my dev env

The "something badly wrong" was that I had set up the project to be
merely a win32 app rather than a win32 CONSOLE app. I should have
taken the hint that WinMain was unresolved.

-- Pete

Vincent Fatica

unread,
Apr 4, 2009, 12:30:58 PM4/4/09
to
On Sat, 4 Apr 2009 03:19:53 -0700 (PDT), pete <pet...@yahoo.com> wrote:

|1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
|_WinMain@16 referenced in function ___tmainCRTStartup
|1>Debug\hello-world.exe : fatal error LNK1120: 1 unresolved externals
|
|I must have changed something somewhere in VC6 defaults to give this
|crazy-seeming error, but what?
|
|Can someone please give me a clue as to what's going on?

I don't think it's a default. (Not particularly remembering VC6,) if you specify
"Windows Application" when you create a project it'll look for WinMain, if you
specify "Console Application", main (tmain, wmain). It's changeable. Check the
project's Properties ... Linker ... System ... Subsystem.
--
- Vince

Jaelani

unread,
Apr 4, 2009, 11:43:03 AM4/4/09
to

I'm not quite familiar with C development, but does that mean a VC Win32
console project has complete control over the EXE entry point code?

pete

unread,
Apr 4, 2009, 3:25:17 PM4/4/09
to
On Apr 4, 11:43 am, Jaelani <jaeju...@googlemail.com> wrote:

> I'm not quite familiar with C development, but does that mean a VC Win32
> console project has complete control over the EXE entry point code?

Yes, I believe you can consider it so, practically speaking. There is
first some run-time setup; and then main() is called as a function by
the runtime, upon which the main program is in control.

-- Pete

0 new messages