且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 64 位机器上将 C++ 程序编译为 64 位?

更新时间:2022-01-20 21:29:01

-m32 只能来自你的 makefile 中的某个地方,你必须追踪它(使用递归 grep)并删除它.

-m32 can only be coming from somewhere in your makefiles, you'll have to track it down (use a recursive grep) and remove it.

当我能够强制使用 -m64 时,我得到您选择的 CPU 不支持 x86-64 指令集".有任何线索吗?.uname -a 给出 x86_64

When I am able to force -m64, I get "CPU you selected does not support x86-64 instruction set".Any clues?. uname -a gives x86_64

那个错误意味着在 makefile 中有一个类似 -march=i686 的选项,它对 64 位编译无效,也尝试删除它.

That error means there is an option like -march=i686 in the makefiles, which is not valid for 64-bit compilation, try removing that too.

如果你不能删除它(再努力一点!)然后在命令行上添加 -march=x86-64 将指定一个通用的 64 位 CPU 类型.

If you can't remove it (try harder!) then adding -march=x86-64 after it on the command line will specify a generic 64-bit CPU type.