title: Increase stack size on Windows cmd MinGW C++
body: <p>I'm running code on my 64 bit Windows 8 system with 8&nbsp;GB RAM, given to me for my project, involving essentially three dimensional matrices, and these matrices are huge (20x20x60000). After I compile the code in the Linux terminal I run:</p>
  
  <pre><code>ulimit -s unlimited
  </code></pre>
  
  <p>and then I can execute the programme as expected.</p>
  
  <p>On my Windows command prompt I am able to use the command:</p>
  
  <pre><code>g++ -I"C:\gsl" -L"C:\gsl" main.cp -o main.exe -lgsl -lgslcblas -Wall -lm
  </code></pre>
  
  <p>But gives me an error:</p>
  
  <pre><code>main.cp:141:6: error: total size of local objects too large
  void TrajectoryAdd(void *p, double time)
  </code></pre>
  
  <p>The above command works perfectly when I reduce the size of the matrix and so I'm assuming that the stack size is not big enough. So I've been trying to use:</p>
  
  <pre><code>g++ -Wl,--stack,46777216
  </code></pre>
  
  <p>But that returns:</p>
  
  <pre><code>undefined reference to `WinMain@16'
  collect2.exe: error: ld returned 1 exit status
  </code></pre>
  
  <p>I've tried variations of this command as suggested on other posts, but that doesn't seem to work, that is,</p>
  
  <pre><code>g++ -Wl,--stack,46777216 -o -I"C:\gsl" -L"C:\gsl" main.cp -o main.exe -lgsl -lgslcblas -Wall -lm
  </code></pre>
  
  <p>For some slightly smaller matrices I have been able to compile, but when I run the executable I get a Windows error: Main.exe has stopped working.</p>
  
  <p>I'm a beginner in C++, and so I will not be able to commit to the other solution of modifying the source code.</p>