title: undefined reference to symbol '_ZN12QSqlDatabase11setHostNameERK7QString'
body: <p>My program has a basic function for adding datas to database but when the code gives an error when it is compiled. </p>
  
  <pre><code>void MainWindow::AddLocationToDatabase()
  {
      QSqlDatabase db= QSqlDatabase::addDatabase("QMYSQL");
      db.setHostName("localhost");
      db.setUserName("root");
      db.setPassword("*******");
      db.setDatabaseName("databasename");
      db.setPort(1111);
  
      if(db.open()){
            qDebug()&lt;&lt;"connected";
      }
  
  }
  </code></pre>
  
  <p>/usr/bin/ld: build/debug/mainwindow.o: undefined reference to symbol '_ZN12QSqlDatabase11setHostNameERK7QString'</p>
  
  <p>/usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  make: *** [sub-pcapprogram-make_first-ordered] Error 2
  06:57:04: The process "/usr/bin/make" exited with code 2.
  When executing step "Make"</p>