Mingw:在Linux系统下编译Windows的程序

Ubuntu下可以直接安装:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime

安装后编译程序可以:
i586-mingw32msvc-g++(编译C++程序)
i586-mingw32msvc-gcc(编译C程序)

用法和gcc/g++非常类似。
如hello.c程序:
#include "windows.h"
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

http://tieba.baidu.com/p/733815195

http://www.cnblogs.com/lvdongjie/p/3763032.html

------------------------------------------------------------------

whereis i586-mingw32msvc-gcc

结果发现2个:/usr/bin 和 /usr/bin/X11,也不知道在我安装mingw之前,是否已经存在。

另外,我觉得这个安装的是mingw-w32,而不是mingw

另外,我在/usr/amd64-mingw32msvc和/usr/i586-mingw32msvc两个目录,也不知道在我安装mingw之前,是否已经存在。

到底mingw-w32到底安装到哪里了?目前 /opt 目录是空的。应该在纯净Linux下运行whereis 和 ls /usr 和 ls /opt

i586-mingw32msvc-gcc -v可以观察到很多信息。

Ubuntu下可以直接安装mingw(sudo apt-get install mingw32 mingw32-binutils mingw32-runtime,附例子,简单好用,亲测成功)good的更多相关文章

  1. 【转】Win7下VS2010中配置Opencv2.4.4的方法(32位和64位都有效)(亲测成功)

    在vs2010下配置opencv是件痛苦的事情,一点点错误可能就会导致莫名其妙的报错,各种error让人郁闷不已,这里提供给大家一篇vs2010下配置opencv2.4.4的方法,我是64位的win7 ...

  2. 2010-01-20 12:09 ubuntu下minicom的安装及使用

    转http://hi.baidu.com/npugtawqdnbgqrq/item/106f805409b42813db163527 ubuntu下minicom的安装及使用 安装: sudo apt ...

  3. Ubuntu下git的安装与使用

    Ubuntu下git的安装与使用 Ubuntu下git的安装与使用与Windows下的大致相同,只不过个人感觉在Ubuntu下使用git更方便. 首先,确认你的系统是否已安装git,可以通过git指令 ...

  4. Ubuntu下Speedtest的安装

    要安装Speedtest,需要先安装apache,参见<Ubuntu下Apache的安装>一文:*(再安装LAMP server,参见<Ubuntu下快速安装LAMP server& ...

  5. Ubuntu下Apache的安装

    Ubuntu下可快速安装LAMP server(Apache+MySQL+PHP5),参见<Ubuntu下快速安装LAMP server>一文. 也可以手动安装Apache.本文介绍如何手 ...

  6. Linux(Ubuntu)下MySQL的安装与配置

    转自:http://www.2cto.com/database/201401/273423.html 在Linux下MySQL的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕.今 ...

  7. ubuntu下boost编译安装

    ubuntu下boost编译安装 boost 安装 1.依赖安装 apt-get install mpi-default-dev libicu-dev python-dev python3-dev l ...

  8. ubuntu 下redis的安装简介

    Linux公社:https://www.linuxidc.com/topicnews.aspx?page=2&tid=2 简单介绍下ubuntu下redis的安装方式: 第一种: 1:进入re ...

  9. Ubuntu下opencv的安装及IDEA开发配置

    Ubuntu下opencv的安装及IDEA开发配置 环境配置  这篇博客主要介绍Ubuntu下opencv的安装编译,以及IDEA对opencv进行Java开发的环境配置 安装opencv 首先安装o ...

随机推荐

  1. 【u118】日志分析

    Time Limit: 1 second Memory Limit: 128 MB [问题描述] M 海运公司最近要对旗下仓库的货物进出情况进行统计.目前他们所拥有的唯一记录就是一个记录集装箱进出情况 ...

  2. openstack中虚拟机怎么与物理机通信

    How-to-connection-ns-outside 环境配置 网络接口 vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE ...

  3. Apache+tomcat的整合 分类: C_OHTERS 2014-05-07 15:08 293人阅读 评论(0) 收藏

    http://blog.csdn.net/stefyue/article/details/6918542 为什么要做这个整合呢?当然,首先想到是就是Apache和Tomcat的区别.正因为有区别,有各 ...

  4. jquery 多选框 checkbox 获取选中的框

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  5. vs 2013 常用快捷键及常见问题的解决

    1. 代码编辑 关闭当前文档:ctrl + F4 打开光标所在位置的文档:ctrl + G(shift + g) 返回上次编辑的位置:ctrl + -(键盘数字键 0 后的那个按键) 移动光标所在的行 ...

  6. dot-- 资源汇总

    http://graphviz.org/doc/info/attrs.htmlhttp://graphs.grevian.org/http://graphs.grevian.org/exampleht ...

  7. 【31.58%】【codeforces 719B】 Anatoly and Cockroaches

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  8. 原生js如何实现图片翻转旋转效果?

    原生js如何实现图片翻转旋转效果? 一.总结 1.通过给元素设置style中的transition来实现的. 2.我昨天纠结的效果全部可以通过精读这个代码后实现. 二.原生js如何实现图片翻转旋转效果 ...

  9. 【codeforces 755C】PolandBall and Forest

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  10. [React] Render Basic SVG Components in React

    React loves svg just as much as it loves html. In this lesson we cover how simple it is to make SVG ...