01. Code::Blocks 之 Increase Stack Size 的方法
Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -Wl,-stack,填需要的大小
// eg : -Wl,-stack,50000000
02. Dev C++ 之 Increase Stack Size 的方法
Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -Wl,-stack,填需要的大小
// eg : -Wl,-stack,50000000
03. Microsoft Visual C++ 6.0 之 Increase Stack Size 的方法
Project -> Settings -> Link -> Category -> Output -> Stack allocations -> Reserve -> 填需要的大小
// Max : 4,294,967,295 bytes;可以填 10 or 16 進位;單位為 byte;Commit 可以不填。
// eg : 填 50000000 = 填 0x2faf080
04. Sample Code
# include <iostream>
# define SIZE 12345678
using namespace std;
int main( ) {
int test[ SIZE ] = { 0 };
for ( int i = 0; i < SIZE; i++ ) {
test[ i ] = i;
}
cout << test[ SIZE - 1 ] << "\nWho-Know.Com" << endl;
cout << SIZE * sizeof( int ) << " bytes" << endl;
cout << sizeof( test ) << " bytes" << endl;
system( "PAUSE" );
return 0;
}
Ref :
01. /STACK (Stack Allocations)
Tags: C++ IDE, Code::Blocks, Stack, Windows


