Ubuntu下可以直接安装: 7LrLinux联盟 sudo apt-get install mingw32 mingw32-binutils mingw32-runtime 7LrLinux联盟 安装后编译程序可以: 7LrLinux联盟 i586-mingw32msvc-g++(编译C++程序) 7LrLinux联盟 i586-mingw32msvc-gcc(编译C程序) 7LrLinux联盟 用法和gcc/g++非常类似。 7LrLinux联盟 如hello.c程序: 7LrLinux联盟 #include
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR szCmdLine,
int iCmdShow)
{
MessageBox (NULL, "Hello", "Hello Demo", MB_OK);
return (0);
} |
编译: 7LrLinux联盟 i586-mingw32msvc-gcc hello.c -o hello.exe -mwindows 7LrLinux联盟 注:-mwindows指示其编译的是windows程序,若编译的是console(命令行)程序,则不需要这个参数。 7LrLinux联盟 若安装了wine,还可以测试一下这个程序: 7LrLinux联盟 wine hello.exe 7LrLinux联盟
|