Linker cannot find WinMain() in object
From: Min Sheng Lu (minsheng.lu_at_antlimited.com)
Date: 07/09/04
- Next message: Yvan: "Please help: Cannot setup a VPN client over dialup (modem) with Windows CE"
- Previous message: David Liao \(MS\): "Re: USB driver matching by interface no."
- Next in thread: Michael J. Salamone [eMVP]: "Re: Linker cannot find WinMain() in object"
- Reply: Michael J. Salamone [eMVP]: "Re: Linker cannot find WinMain() in object"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 09 Jul 2004 18:21:51 +0100
Hi all,
I am porting an application to WinCE.net, and I found that compilation
fails at the linking stage as the linker cannot find the entry point in
my compiled objects:
"LIBC.lib(wincrt0.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function _WinMainCRTStartup"
Now this is strange as WinMain() is declared correctly and compiled ok,
and the linker options have /entry:WinMainCRTStartup set so things
should work ok.
I am currently linking against winmgr.lib, coredll.lib and winsock.lib
only, and NOT corelibc.lib, would that make a difference?
I tried to write a dummy test function, shown below, and tried to link
that against coredll.lib but the linker still gives the same error. So a
bit confused now and any help would be much appreciated.
Thanks
Min
file:main.c
#include <winbase.h>
int
WINAPI
WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nShowCmd
)
{
int argc = __argc;
char **argv = __argv;
NOT_USED( hPrevInstance);
NOT_USED( lpCmdLine);
/* skip function name */
argc--;
argv++;
return 0;
}
Linker output:
C:/WINCE420/SDK/BIN/I386/link /nologo /base:"0x00010000"
/stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no
/pdb:"SIS550" /out:bin/main.exe main.obj coredll.lib
LIBC.lib(wincrt0.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function _WinMainCRTStartup
main.exe : fatal error LNK1120: 1 unresolved externals
- Next message: Yvan: "Please help: Cannot setup a VPN client over dialup (modem) with Windows CE"
- Previous message: David Liao \(MS\): "Re: USB driver matching by interface no."
- Next in thread: Michael J. Salamone [eMVP]: "Re: Linker cannot find WinMain() in object"
- Reply: Michael J. Salamone [eMVP]: "Re: Linker cannot find WinMain() in object"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|