_tmain是main为了支持unicode所使用的main的别名 ._tmain()不过是unicode版本的的main().
<stdafx.h>中包含了
#include <stdio.h>
#include <tchar.h>
其中<tchar.h>里找到_tmain的宏定义
#define _tmain main
经过预编译以后, _tmain就变成main了
main()是标准C++的函数入口。默认字符编码格式ANSI (在简体中文Windows操作系统中,ANSI 编码代表 GBK 编码;在繁体中文Windows操作系统中,ANSI编码代表Big5;在日文Windows操作系统中,ANSI 编码代表 Shift_JIS 编码。)。
故Windows操作系统提供的对unicode字符集和ANSI字符集进行自动转换用的程序入口点函数
当你程序当前的字符集为unicode时,int _tmain(int argc, TCHAR *argv[])会被翻译成 int wmain(int argc, wchar_t *argv[])
当你程序当前的字符集为ANSI时,int _tmain(int argc, TCHAR *argv[])会被翻译成 int main(int argc, char *argv[])
原文地址:https://blog.csdn.net/zhangcancai/article/details/45168957