使用mingw进行编译时会增加堆栈大小吗? [英] Increase stack size when compiling with mingw?

查看:286
本文介绍了使用mingw进行编译时会增加堆栈大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个递归的填充算法,以查找图像中的连接组件,我的代码可以编译并与MSVC 2008编译器一起很好地运行;但是mingw编译的二进制文件在运行时崩溃了.

I'm writing a recursive flood-fill algorithm to find connected components in an image, my code compiles and runs well with MSVC 2008 compiler; but the mingw-compiled binary crashed at runtime.

使用std :: stack将算法转换为非递归算法后,一切顺利.

After I converted the algorithm to non-recursive with std::stack, everything goes well.

但是如果我在某些情况下必须使用递归算法而mingw无法处理该怎么办?

But what if I must use recursive algorithm in some case, and mingw cannot handle it?

如何增加二进制文件的堆栈大小,是否有任何编译选项?

How can I increased stack size of a binary, is there any compilation options?

谢谢

推荐答案

使用

gcc -Wl,--stack,N

其中N是堆栈大小.例如. gcc -Wl,--stack,4194304

where N is stack size. E.g. gcc -Wl,--stack,4194304

这篇关于使用mingw进行编译时会增加堆栈大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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