C/C++ entry point: main, wmain, WinMain, wWinMain v.s. _UNICODE
2015-01-13 11:05
369 查看
Dev Env: In Microsoft Visual Studio C++ 2010
main() -
Console, ANSI;
wmain() -
Console, UNICODE;
WinMain() -
GUI, ANSI
wWinMain() - GUI, UNICODE
But note that Microsoft Visual studio C/C++ Project Wizard generated _tmain() and _tWinMain() for user and not any of above ones.
It's _tmain() for Console application;
It's _tWinMain() for GUI appliaction.
Actually _tmain and _tWinMain is macros which points to correct entry point function according to _UNICODE definition or not.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\tchar.h
#ifdef _UNICODE
...
#define _tmain wmain
#define _tWinMain wWinMain
...
#else /* ndef _UNICODE */
#define _tmain main
#define _tWinMain WinMain
then the next question is - where _UNICODE macro is defined?
Project properties --> Configuration Properties --> General --> Project Defaults --> Character Set --> "Use Unicode Character Set"
with this setting, the compiler will defines _UNICODE macro before it begins compiling.
main() -
Console, ANSI;
wmain() -
Console, UNICODE;
WinMain() -
GUI, ANSI
wWinMain() - GUI, UNICODE
But note that Microsoft Visual studio C/C++ Project Wizard generated _tmain() and _tWinMain() for user and not any of above ones.
It's _tmain() for Console application;
It's _tWinMain() for GUI appliaction.
Actually _tmain and _tWinMain is macros which points to correct entry point function according to _UNICODE definition or not.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\tchar.h
#ifdef _UNICODE
...
#define _tmain wmain
#define _tWinMain wWinMain
...
#else /* ndef _UNICODE */
#define _tmain main
#define _tWinMain WinMain
then the next question is - where _UNICODE macro is defined?
Project properties --> Configuration Properties --> General --> Project Defaults --> Character Set --> "Use Unicode Character Set"
with this setting, the compiler will defines _UNICODE macro before it begins compiling.
相关文章推荐
- main,tmain,winmain()等函数——UNICODE
- main,tmain,winmain()等函数——UNICODE - sensensen - 博客园
- _tmain与main,winMain,wmain收藏
- C++ 程序启动入口函数main还是winmain?
- 越过c++默认winmain/main直接进入口
- _tmain(), wmain(), winmain(), _twinmain()这些函数的区别
- [转载]_tmain main wmain WinMain
- main(), _tmain(), wmain(), wWinMain(), _tWinMain()的区别
- int APIENTRY WinMain与int WiINAPI WinMain 及int CALLBACK WinMain是一样的
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- _tmain与main,winMain,wmain
- main,wmain: a ansi,unicode version of _tmain
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- main(),_tmain(),WinMain(),wmain()四个函数区别
- _tmain与main,winMain,wmain收藏
- C++ WinMain(模板)
- 关于不同的程序入口,main(), _tmain(),WinMain(),wmain()?
- _tmain main wmain WinMain
- Unicode-enabling Microsoft C/C++ Source Code
- Unicode-enabling Microsoft C/C++ Source Code