如何在Linux上调用MinGW交叉编译器?

编程入门 行业动态 更新时间:2024-10-16 00:22:45
本文介绍了如何在Linux上调用MinGW交叉编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个要针对Windows进行交叉编译的项目.我有适当的Makefile,并且所有内容都可以与g++一起使用.我跑了

I have a project that I want to cross-compile for Windows. I have the appropriate Makefile and everything works with g++. I've run

$ apt install mingw-w64

并下载了500 MB的软件包,但我无法找到如何实际运行它的方法.没有mingw可执行文件,那么我该如何实际编译它?

and downloaded 500 MB of packages, but I cannot find out how to actually run it. There is no mingw executable, so how do I actually compile with it?

推荐答案

如果您查看Ubuntu软件包Web服务器上的mingw-w64组成软件包的文件列表:

If you look at the file lists on the Ubuntu package webserver for mingw-w64's constituent packages:

  • gcc-mingw-w64-x86-64
  • g++-mingw-w64-x86-64
  • binutils-mingw-w64-x86-64
  • mingw-w64-x86-64-dev
  • gcc-mingw-w64-i686
  • g++-mingw-w64-i686
  • binutils-mingw-w64-i686
  • mingw-w64-i686-dev
  • gcc-mingw-w64-x86-64
  • g++-mingw-w64-x86-64
  • binutils-mingw-w64-x86-64
  • mingw-w64-x86-64-dev
  • gcc-mingw-w64-i686
  • g++-mingw-w64-i686
  • binutils-mingw-w64-i686
  • mingw-w64-i686-dev

您会看到mingw-w64提供了 toolchain ,即,一组用于为另一个系统编译代码的替代工具(编译器,链接器,标头等).

You can see that mingw-w64 provides a toolchain, i.e. a set of alternative tools (compiler, linker, headers, etc.) used to compile your code for another system.

假设您要为64位系统编译C ++代码,则需要使用/usr/bin/x86_64-w64-mingw32-g++-win32.您可以使用CXX环境变量来告诉大多数Makefile使用该编译器来编译代码.

Assuming you want to compile C++ code for a 64-bit system, you'll need to use /usr/bin/x86_64-w64-mingw32-g++-win32. You can use the CXX environment variable to tell most Makefiles to use that compiler to compile code.

更多推荐

如何在Linux上调用MinGW交叉编译器?

本文发布于:2023-11-16 15:18:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605456.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编译器   如何在   Linux   MinGW

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!