Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101015312
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-03-21 21:59:54

来源:赛迪网    作者:sixth

Ubuntu下可以直接安装:

sudo apt-get install mingw32 mingw32-binutils mingw32-runtime

安装后编译程序可以:

i586-mingw32msvc-g++(编译C++程序)

i586-mingw32msvc-gcc(编译C程序)

用法和gcc/g++非常类似。

如hello.c程序:

#include 

int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR szCmdLine,
int iCmdShow)
{
MessageBox (NULL, "Hello", "Hello Demo", MB_OK);
return (0);
}

编译:

i586-mingw32msvc-gcc hello.c -o hello.exe -mwindows

注:-mwindows指示其编译的是windows程序,若编译的是console(命令行)程序,则不需要这个参数。

若安装了wine,还可以测试一下这个程序:

wine hello.exe

阅读(350) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~