字符集为UNICODE的MFC程序为什么要加入口点wWinMainCRTStartup?

fhw217 2016-07-29 10:12:01
我用的是VC6,MFC程序,字符集是UNICODE,动态链接MFC42U.DLL,编译时提示找不到入口点_WinMain@16,手动加入入口点wWinMainCRTStartup后程序正常编译。
我的问题是:为什么要手动填写入口点,wWinMain存在于MFC42U.DLL中,链接器为什么不在MFC42U.DLL的导入库中查找wWinMain,然后根据wWinMain自动选择入口点wWinMainCRTStartup(不必手动填写)?

下面是主函数位于 MFC42u.dll 中。

extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
...全文
200 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgl7903 2016-07-29
  • 打赏
  • 举报
回复
这个应该是属于VC6的小BUG https://www.microsoft.com/middleeast/msdn/faq.aspx Question 3: I'm using Visual C++ 6.0. I need to store data as Unicode and access it using Unicode instead of ANSI to make the application independent of the system locale. Answer You need to build your project as Unicode. To take advantage of the MFC and C run-time support for Unicode, you need to: · Define _UNICODE. At Project settings\C/C++\Preprocessor definitions, define the symbol _UNICODE. · Specify entry point. In the Output category of the Link tab in the Project Settings dialog box, set the Entry Point Symbol to wWinMainCRTStartup. You will need to add some Unicode libraries and DLLs, you find them on your Visual Studio CDs or the MSDN. You need to make sure that your code is Unicode aware.
fhw217 2016-07-29
  • 打赏
  • 举报
回复
更正一下,编译错误时的提示是:

msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
Eleven 2016-07-29
  • 打赏
  • 举报
回复
你看一下 你的工程设置属性中的入口写的是哪个~

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧