如何用Mingw编译Linux程序? [英] How to compile a Linux program with Mingw?

查看:304
本文介绍了如何用Mingw编译Linux程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Linux程序,我想在Windows上运行。我想使用Mingw为Windows编译?
我是这个Mingw的新人。所以,我不知道它是否会工作。

我安装Mingw和我有一个make文件。下一步是什么?我有一堆exe文件在Mingw。我甚至不知道如何启动编译器。

I have a Linux program that I want to run on Windows. I want to compile it for Windows using Mingw? I am new to this Mingw thingy. So, I have no idea if it will work.
I installed Mingw and I have a make file. What's next? I have a bunch of exe files in Mingw. I don't even know how to start the compiler.

所以,我的问题是:有什么步骤需要编译我有的程序?

So, my question is: What are the steps necessary to compile the program I have?

我想出了到底需要执行哪些步骤使用Mingw编译Win的Linux程序。

我发布了下面的解决方案(解决方案是7个步骤),也许对其他人也是有用的。

I figured out in the end what are the steps necessary to compile a Linux program for Win using Mingw.
I posted the solution below (solution is 7 steps), maybe it will be useful to others also.

推荐答案

要在Win上编译Linux程序:

To compile a Linux program on Win:


  1. 安装MingW

  2. 编辑c:\MinGW \ msys\1.0\etc\fstab文件(应包含此行: c:/ mingw / mingw

  3. 执行 c:\MinGW\msys\1.0\msys.bat

  4. 在shell中,转到您的Make文件所在的文件夹(使用 cd 命令)。

  5. 键入make。

  6. 将生成的EXE和所需的DLL(libgcc_s_dw2-1.dll和libstdc ++ - 6.dll)放在同一个文件夹中

  7. 运行exe文件并享受它....

  1. Install MingW
  2. Edit the c:\MinGW\msys\1.0\etc\fstab file (it should contain this line: c:/mingw /mingw )
  3. Start Wingw shell by running c:\MinGW\msys\1.0\msys.bat
  4. In shell go to the folder where your Make file is (use cd command for this).
  5. Type 'make'. This will compile your program.
  6. Put the generated EXE and the required DLLs (libgcc_s_dw2-1.dll and libstdc++-6.dll) in the same folder
  7. Run the exe file and enjoy it....

这篇关于如何用Mingw编译Linux程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆