wWinmain,Unicode和Mingw [英] wWinmain, Unicode, and Mingw

查看:402
本文介绍了wWinmain,Unicode和Mingw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Windows API,并使用mingw作为我的编译器与Code :: Blocks作为我的IDE。我遇到了一个问题,使用wWinMain函数。我使用位于此处的程序链接文字。它编译罚款VSC ++ 2008 express但使用mingw时我得到未定义的引用WinMain @ 16的错误。我已经想出了什么问题是(我想)。通过替换wWinMain只用Winmain和字符串指针PWSTR与LPSTR它完美编译。我的问题是,我如何解决这个问题,如果没有,就不使用Unicode这么大的交易。



谢谢。


<使用平凡(非unicode) WinMain 函数,然后使用 =http://msdn.microsoft.com/en-us/library/ms683156%28VS.85%29.aspx> GetCommandLineW 。 MinGW不知道 wWinMain



你可能会找到工作在MinGW困难; 上次我使用它不支持大多数 wchar_t C ++标准库的组件(即 std :: wifstream std :: wstring 等)



你对MSVC有什么反对吗?


I am working on learning the windows API and am using mingw as my compiler with Code::Blocks as my IDE. I have run into an issue with using the wWinMain function. I used the program located here link text. It compiles fine on VSC++ 2008 express but when using mingw i get the "undefined reference to WinMain@16" error. I have figured out what the problem is (i think). By replacing the wWinMain with just Winmain and the String pointer PWSTR with LPSTR it compiles perfectly. My question is, how can i fix this, and if not, is not using Unicode that big of a deal.

Thanks.

解决方案

Use the plain (non unicode) WinMain function, and then get your unicode command line using GetCommandLineW. MinGW doesn't know about wWinMain.

You are probably going to find working on MinGW difficult; last time I used it it did not support most of the wchar_t components of the C++ standard library (i.e. std::wifstream, std::wstring, etc) which made interfacing with Unicode Windows bits difficult.

Do you have anything against MSVC?

这篇关于wWinmain,Unicode和Mingw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆