使用CLion将C ++编译为64位 [英] Compile C++ as 64Bit with CLion

查看:2962
本文介绍了使用CLion将C ++编译为64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行内存消耗算法的c ++应用程序.

I have a c++ application that runs a memory-consuming algorithm.

它崩溃并显示错误:在分配的内存达到约2GB后抛出'std :: bad_alloc'实例后终止调用.

我想将其编译为64Bit,以便它可以从我的64Bit/8GB Ram计算机中分配更多内存.

I want to compile it as 64Bit so it could allocate more memory from my 64Bit/8GB Ram machine.

如何做到?

我正在使用CLion,使用CMake进行构建并使用mingw版本: mingw-w64 \ i686-4.8.3-posix-dwarf-rt_v3-rev2 btw-wingw安装在C:\Program Files (x86)\mingw-w64下与这个问题有关吗?

Im working with CLion, building with CMake and using mingw version: mingw-w64\i686-4.8.3-posix-dwarf-rt_v3-rev2 btw - the wingw is installed under C:\Program Files (x86)\mingw-w64 is this related to the issue?

我一直在这里看: 在C语言中检测64位编译 并且(不出所料)我可以看到我的应用程序没有__x86_64__

I've been looking here: Detecting 64bit compile in C and (not suprisingly) I can see that my application does not have the __x86_64__

推荐答案

如OP所建议,将我的评论发布为答案:为此,您需要将-m64选项传递给编译器/链接器.

As suggested by OP, posting my comment as an answer: for this you need to pass -m64 option to compiler/linker.

这篇关于使用CLion将C ++编译为64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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