使用 MinGW (Dev-C++) 编译 64 位二进制文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17988904/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compile 64-bit binary with MinGW (Dev-C++)
提问by Adrian Maire
It is probably a stupid question but i was searching for the answer from about 3h.
这可能是一个愚蠢的问题,但我正在寻找大约 3 小时的答案。
?How to compile 64-bit binary with (Dev-C++) MinGW?
?如何使用 (Dev-C++) MinGW 编译 64 位二进制文件?
I have readed that MinGW support 64bits by default, but i am unable to active this option.
我已经读过 MinGW 默认支持 64 位,但我无法激活此选项。
I have tryed "-m64" but it say: "sorry, unimplemented: 64-bit mode not compiled in"
我试过“-m64”但它说:“对不起,未实现:64位模式未编译”
I am working on Dev-C++ on Windows-7
我正在 Windows-7 上开发 Dev-C++
I know how to do it on MSVC++, but I don't want MSVC++ (cause of ethical issues)
我知道如何在 MSVC++ 上执行此操作,但我不想要 MSVC++(出于道德问题)
What i am trying to compile, just for testing purpose:
我正在尝试编译的内容,仅用于测试目的:
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
// Test compiling mode
if (sizeof(void*) == 8) cout << "Compiling 64-bits" << endl;
else cout << "Compiling 32-bits" << endl;
return 0;
}
采纳答案by greatwolf
To build a 64-bit binary on windows you need the 64-bit version of the mingw compiler. Mingw-W64 is one possible distribution you can use. You can find a list of downloads here.
要在 Windows 上构建 64 位二进制文件,您需要 64 位版本的 mingw 编译器。Mingw-W64 是您可以使用的一种可能的发行版。您可以在此处找到下载列表。
Additionally, you can also find Dev-C++ setup bundled with mingw 64-bit compiler under Orwell Dev-C++'s download section. Make sure you choose "TDM-GCC x64 4.7.1" either setup or portable.
此外,您还可以在Orwell Dev-C++的下载部分下找到与 mingw 64 位编译器捆绑在一起的 Dev-C++ 设置。确保您选择了“ TDM-GCC x64 4.7.1”,无论是设置还是便携式。