所以我开始上课
#include <wchar.h>
#include <stdlib.h>
Run Code Online (Sandbox Code Playgroud)
并且有一个wmain功能.
它与我在C/C++程序中常用的主要功能有什么不同?
我们可以在Unix编译器中使用wmain()函数,还是只在\ for windows上使用?
我重新安装了Code :: Blocks(我安装了一个用于Windows 7的GCC编译器(codeblocks-10.05mingw-setup.exe)).然后我尝试编译这个非常简单的代码:
int wmain(int argc, wchar_t* argv[])
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息:
C:\研发\ IDE \代码块\ MinGW的\ BIN ..\LIB\GCC \的mingw32\4.4.1 ......\libmingw32.a(main.o),此:main.c中|| 未定义的引用`WinMain @ 16'| || ===构建完成:1个错误,0个警告=== |
当我尝试使用main()条目运行我的代码时,它会按预期运行而不会出现任何错误或警告.我如何wmain()在我的代码中使用?我需要做哪些修改?
我需要解析unicode参数,所以我想改用wmain.
而不是
int main(int argc, char** argv)
Run Code Online (Sandbox Code Playgroud)
我想用
int wmain(int argc, wchar_t** argv)
Run Code Online (Sandbox Code Playgroud)
问题是视觉工作室没有识别出wmain,而是试图使用main代替:
error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup
Run Code Online (Sandbox Code Playgroud)
这是我试过的:
更改入口点(在这种情况下,我对甚至没有入口点的库有很多兼容性错误,因此无法在那里指定).
warning LNK4258: directive '/ENTRY:mainCRTStartup' not compatible with switch '/ENTRY:mainWCRTStartup'; ignored
Run Code Online (Sandbox Code Playgroud)试了一下_tmain,只是为了发现它只是一个将它改为main的宏.
什么都没有帮助.
编辑:我想提一下,我正在使用vs120_xp(Win xp兼容)工具集,但是当我尝试使用默认工具集时,它仍然无效.
编辑2:我试图制作全新的项目,并且wmain在开箱即用.我没有必要改变任何东西,所以它必须是当前项目中导致它的一些特定设置.