John D
John D

Reputation: 51

Setting stack size with GCC 4.6.2 C++ Qt, MinGW, Vista

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.

Upvotes: 5

Views: 4779

Answers (2)

Bhagat Vishal
Bhagat Vishal

Reputation: 61

Try this:

ulimit -s STACK_SIZE

Upvotes: 0

opc0de
opc0de

Reputation: 11767

You need to add QMAKE_CXXFLAGS += -Wl,--stack,4194304 to your .pro file.

Upvotes: 3

Related Questions