title: Error compiling Qt application directly with g++ on Ubuntu
body: <p>I try to learn C++ with Qt following examples from a book. On very first example including Qt I have a compilation error:</p>
  
  <pre><code>$ g++ -Wall qtdemo.cpp
  qtdemo.cpp:1:19: fatal error: QString: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>The g++ works fine if I don't include any Qt library. 
  I try to run the same program using Qt Creator and it works if I do a "Qt Console application" but shows error if I do a "Plain C++ application".
  I tried to give a path to <code>QString</code> after g++ command, different configuration etc. It seems g++ can't see Qt at all. 
  I even installed Qt5 on top of already existing on Ubuntu 16.04 Qt4.
  When I check if I have Qt installed it looks everything should be fine:</p>
  
  <pre><code>$ locate QString
  /opt/Qt5.7.0/5.7/Src/qtbase/include/QtCore/QString
  ...
  /opt/Qt5.7.0/5.7/gcc_64/include/QtCore/QString
  ...
  /usr/include/qt4/QtCore/QString
  ...
  
  $ qmake -v
  QMake version 2.01a
  Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu
  </code></pre>
  
  <p>The code I try to run:</p>
  
  <pre><code>#include &lt;QString&gt;
  #include &lt;QTextStream&gt;
  
  QTextStream cout(stdout);
  QTextStream cin(stdin);
  
  int main() {
          QString s1("This "), s2("is s "), s3("string");
          s1 += s2; //concatenation
          QString s4 = s1+s3;
          cout &lt;&lt; s4 &lt;&lt; endl;
          cout &lt;&lt; "The length of that string is " &lt;&lt; s4.length() &lt;&lt; endl;
          cout &lt;&lt; "Enter a sentence with withspace: " &lt;&lt; endl;
          s2 = cin.readLine();
          cout &lt;&lt; "Here is your sentence: \n" &lt;&lt; s2 &lt;&lt; endl;
          cout &lt;&lt; "The length of your sentnce is: " &lt;&lt; s2.length() &lt;&lt; endl;
          return 0;
  }
  </code></pre>
  
  <p>I don't know how to make Qt application works from command line with g++ and where the error comes from. </p>