2012-06-07 20 views
5

我做了Code :: Blocks的全新安裝(我安裝了the one for Windows 7 which comes with GCC compiler(codeblocks-10.05mingw-setup.exe))。然後我試圖編譯這個非常簡單的代碼:如何在Code :: Blocks中使用wmain()入口點?

int wmain(int argc, wchar_t* argv[]) 
{ 
    return 0; 
} 

我得到這個錯誤信息:

c:\development\ide\codeblocks\mingw\bin..\lib\gcc\mingw32\4.4.1......\libmingw32.a(main.o):main.c|| undefined reference to `[email protected]'| ||=== Build finished: 1 errors, 0 warnings ===|

當我嘗試運行我用main()入口代碼,它運行正常,沒有任何錯誤或警告。我如何在我的代碼中使用wmain()?我必須做些什麼修改?

回答

2

最新的解決方案是使用-municode選項而不是mingw-unicode-main包裝。

有關詳細信息,請參閱:

+0

'的mingw32-GCC-4.8.1.exe:錯誤:無法識別的命令行選項「-municode'' –

+1

注:'-municode'必須添加到*鏈接器設置*中。 –

+1

當在鏈接器設置中添加「-municode」時,我得到了與最新的Code :: Blocks(16.01)相同的錯誤(鏈接器是mingw32-g ++。exe,而MinGW目錄也包含mingw32-gcc-4.9.2。 exe(它也不能識別該選項),但是沒有mingw32-g ++ - 4.9.2.exe) – Medinoc