有没有办法在Ubuntu的IDE(例如Anjuta)中创建(C++或C#)的Windows控制台应用程序,并将其编译为Windows?
来自此页面:
sudo apt-get install wine mingw32 mingw32-binutils mingw32-runtime
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL,
"Cette fenêtre prouve que le cross-compilateur est fonctionnel !",
"Hello World", MB_OK);
return 0;
}
i586-mingw32msvc-g++ -o essai.exe essai.cpp
gunzip -c /usr/share/doc/mingw32-runtime/mingwm10.dll.gz > mingwm10.dll
wine essai.exe
<ESC>:e ++enc=cp1252
另一个更强大的解决方案是使用UTF-8,但这需要改变字符串处理的方式。