zoukankan      html  css  js  c++  java
  • [转]linux 上编译windows程序


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

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

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

    如hello.c程序:
    QUOTE:
    #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

    不过,我本来是想编译wxWidgets程序的,但发现这个好像还是有点问题,估计还需要wxWidgets for mingw32@linux
  • 相关阅读:
    POJ
    POJ
    POJ
    POJ
    POJ
    ZOJ
    HDU
    python中主要存在的四种命名方式:
    python 中的 赋值 浅拷贝 深拷贝
    python中sorted方法和列表的sort方法使用
  • 原文地址:https://www.cnblogs.com/foxhengxing/p/1896318.html
Copyright © 2011-2022 走看看