4

I want to increase the stack size of my program because I have a complex recursive algorithm it would be a REAL pain to rewrite iteratively.

I am using GCC C++ 4.6.2. MinGw, building with a Qt .pro file (I'm using Qt for the GUI front end), on Vista.

Advice on this website is to use:-

gcc -Wl,--stack,4194304

and to send this to the g++ link phase with:-

LIB += -Wl,--stack,4194304

but the linker errors with:-

g++: error: unrecognized option '--stack,4194304'

I have tried sending the options to the compile phase with QMAKE_CXXFLAGS += but g++ still barfs.

The only option that does not barf is -fno-stack-limit from the GCC documentation (.pdf 4.5.0, p.260), but my stack still overflows. The other options mentioned in that para. barf.

4

2 回答 2

2

您需要添加QMAKE_CXXFLAGS += -Wl,--stack,4194304到您的 .pro 文件中。

于 2012-10-29T07:34:36.217 回答
0

尝试这个:

ulimit -s STACK_SIZE
于 2014-02-27T12:23:37.983 回答