用EVC编译wince console方式的应用程序

用EVC编译wince console方式的应用程序

收藏
应用EVC的appwizard生成一个空的project
加入测试代码如下:
#include <windows.h>

int WINAPI
_tmain(int argc, char ** argv)
{
wprintf(L"Hello, Wince console.\r\n");
return 0;
}
编译这个evc工程报错
Linking...
corelibc.lib(pegwmain.obj) : error LNK2019: unresolved external symbol _WinMain referenced in function _WinMainCRTStartup
emulatorDbg/console.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

console.exe - 2 error(s), 0 warning(s)

报错的原因是入口有问题,WinMainCRTStartup在CE的unicode系统上应该是mainWCRTStartup。
到中project Settings将Link >> Output >> entry-point symbol改为mainWCRTStartup。
ReBuild,OK。

D:\WINCE500\PUBLIC\COMMON\CESYSGEN\makefile中解释了CE下几个Entry Point
###################################################################################
#
# STEP-4: Add your module to exactly ONE of the following rules, choosing your
#         DLL or EXE entry point. NOTE: DO NOT create new rules
#
# DllEntry/DllMain -- calls entry supplied by module. Does NOT call C++ static ctors/dtors
# DllMainCRTStartup - calls C++ static ctors & dtors. Then calls module's DllMain
# WinMain -- calls module's standard EXE entry point. Does NOT call C++ static ctors/dtors
# WinMainCRTStartup -- Calls C++ static ctors, then calls module's WinMain
# mainWCRTStartup -- for console apps whose entry is wmain(int argc, WCHAR **argv). Also calls C++ ctors/dtors
# mainACRTStartup -- for console apps whose entry is main(int argc, char **argv). Also calls C++ ctors/dtors
#
#################################################################################

for more infomation
The Console in Your Pocket
Rainer Urian - pocketconsole的作者
http://www.symbolictools.de/public/pocketconsole/developers/articles/console_internals.htm
MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcepbguide5/html/wce50grfENTRYEntry-PointSymbol.asp

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ganrong/archive/2005/07/26/435046.aspx

你可能感兴趣的:(console)