title: Qt crashes on system call?
body: <p>I have the following cpp file:</p>
  
  <pre><code>#include &lt;iostream&gt;                  
  #include &lt;stdlib.h&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  
    int main(int,char*[])
    {
      int b = std::system("dot -Tdot ./a.dot -o ./a3.dot");
      cout &lt;&lt; "ret: " &lt;&lt; b &lt;&lt; endl;
      return 0;
    }
  </code></pre>
  
  <p>Running from cmd with:</p>
  
  <pre><code>g++ -O2 -Wall -pedantic -pthread q2.cpp -lboost_graph &amp;&amp; ./a.out
  </code></pre>
  
  <p>Runs fine creating <code>a3.dot</code></p>
  
  <p>Running the same file with <code>qtcreator</code> I get:</p>
  
  <pre><code>Segmentation fault (core dumped)
  ret: 35584
  </code></pre>
  
  <p>This is the compiler output from <code>Qt</code></p>
  
  <pre><code>make: Entering directory `/home/studnet/QtProjects/T2-build-desktop-Qt_4_8_1_in_PATH__System__Release'
  g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../T2 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtDeclarative -I/usr/include/qt4 -I../T2/qmlapplicationviewer -I. -I../T2 -I. -o main.o ../T2/main.cpp
  g++ -Wl,-O1 -o T2 main.o qmlapplicationviewer.o moc_qmlapplicationviewer.o    -L/usr/lib/i386-linux-gnu -lQtDeclarative -lQtGui -lQtCore -lpthread 
  </code></pre>
  
  <p>I tried debugging it in Qt, but I am fairly new to it, and get an assembly Window. I put <code>a.out</code> in the <code>build</code> folder from where qt usually reads the file and in the source folder just in case.</p>
  
  <p>Any suggestions how I can fix this?</p>
  
  <p>Thank you.</p>
  
  <p>EDIT:</p>
  
  <p>I tried this:</p>
  
  <pre><code>QProcess process;
  process.start("dot", QStringList() &lt;&lt; "-Tdot ./a.dot -o ./a3.dot");
  process.waitForFinished(-1);
  </code></pre>
  
  <p>But then I get no file.</p>