Increase stack size when compiling with mingw?(使用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编译时增加堆栈大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用mingw编译时增加堆栈大小?
基础教程推荐
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
