简体   繁体   English

MinGW - 如何强制使用 64 位编译器而不是 32 位编译器 (Windows)

[英]MinGW - How to force 64-bit compiler instead of 32-bit compiler (Windows)

I am running this command on windows with pybind11:我正在使用 pybind11 在 Windows 上运行此命令:

>cmake . -G "MinGW Makefiles"

This command gives me an error:这个命令给了我一个错误:

  Python config failure: Python is 64-bit, chosen compiler is 32-bit
Call Stack (most recent call first):
  lib/pybind11/tools/pybind11Tools.cmake:16 (find_package)
  lib/pybind11/CMakeLists.txt:33 (include)

And yes, I have seen this post , so please don't mark this as duplicate.是的,我看过这篇文章,所以请不要将其标记为重复。 Its different because I'm trying to use MinGW, whereas the answers in this post all uses Visual Studio.它的不同是因为我正在尝试使用 MinGW,而这篇文章中的答案都使用 Visual Studio。 My goal is to generate .pyd files with pybind11, but compiling the C++ source file gives me some weird .vcxproj files that I can't use.我的目标是用 pybind11 生成 .pyd 文件,但是编译 C++ 源文件给了我一些我无法使用的奇怪的.vcxproj文件。

Please teach me how to correctly specify 64-bit or 32-bit of MinGW so that I can generate a .pyd file.请教我如何正确指定 64 位或 32 位的 MinGW,以便我可以生成 .pyd 文件。

As mixing 32-bit and 64-bit will cause trouble sooner or later unless you are extremely careful, I would recommend using seperate toolchains for Windows 32-bit and Windows 64-bit.由于混合 32 位和 64 位迟早会导致麻烦,除非您非常小心,我建议对 Windows 32 位和 Windows 64 位使用单独的工具链。

I recommend getting standalone builds of these toolchains from https://winlibs.com/我建议从https://winlibs.com/获取这些工具链的独立版本

MinGW Makefiles are somewhat slow, so to speed things up you may also consider using Ninja instead (CMake flag -GNinja ). MinGW Makefiles 有点慢,所以为了加快速度,你也可以考虑使用 Ninja(CMake 标志-GNinja )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM