title: Installing ODBC driver on Linux (Ubuntu) for Qt getting syntax error while running "make"
body: <p>I'm trying to connect to SQL Server database on ubuntu in Qt and need to install ODBC driver.
  I did what document had told me to do <a href="http://doc.qt.io/qt-4.8/sql-driver.html" rel="nofollow noreferrer">here</a>. And installed unixOBDC from <a href="http://www.unixodbc.org/" rel="nofollow noreferrer">here</a> into <code>/usr/local/unixODBC</code> then running these commands</p>
  
  <pre><code>cd ~/Qt5.7.0/5.7/Src/qtbase/src/plugins/sqldrivers/odbc
  qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
  make
  </code></pre>
  
  <p>Which resulted in syntax error in couple of the sources <a href="https://i.stack.imgur.com/7R0sX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7R0sX.png" alt=""></a></p>
  
  <p>This is what i get if i run my code at the moment</p>
  
  <pre><code>QSqlDatabase: QODBC driver not loaded
  QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
  </code></pre>
  
  <p>What am i missing?</p>
  
  <p>Edit: </p>
  
  <pre>
      makeg++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_NO_TSLIB -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.5.1 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.5.1/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -I../../../../mkspecs/linux-g++-64 -o .obj/qsql_odbc.o ../../../sql/drivers/odbc/qsql_odbc.cpp
      ../../../sql/drivers/odbc/qsql_odbc.cpp:193:44: error: ISO C++ forbids declaration of ‘Q_DECLARE_SQLDRIVER_PRIVATE’ with no type [-fpermissive]
           Q_DECLARE_SQLDRIVER_PRIVATE(QODBCDriver)
                                                  ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp:193:44: error: expected ‘;’ at end of member declaration
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In constructor ‘QODBCResultPrivate::QODBCResultPrivate(QODBCResult*, const QODBCDriver*)’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:198:33: error: no matching function for call to ‘QSqlResultPrivate::QSqlResultPrivate(QODBCResult*&, const QODBCDriver*&)’
                 hasSQLFetchScroll(true)
                                       ^
      In file included from ../../../sql/drivers/odbc/qsql_odbc.cpp:59:0:
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql/private/qsqlresult_p.h:67:5: note: candidate: QSqlResultPrivate::QSqlResultPrivate()
           QSqlResultPrivate()
           ^
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql/private/qsqlresult_p.h:67:5: note:   candidate expects 0 arguments, 2 provided
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql/private/qsqlresult_p.h:63:20: note: candidate: QSqlResultPrivate::QSqlResultPrivate(const QSqlResultPrivate&)
       class Q_SQL_EXPORT QSqlResultPrivate
                          ^
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql/private/qsqlresult_p.h:63:20: note:   candidate expects 1 argument, 2 provided
      ../../../sql/drivers/odbc/qsql_odbc.cpp:200:30: error: ‘drv_d_func’ was not declared in this scope
               unicode = drv_d_func()->unicode;
                                    ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In member function ‘void* QODBCResultPrivate::dpEnv() const’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:209:49: error: ‘drv_d_func’ was not declared in this scope
           SQLHANDLE dpEnv() const { return drv_d_func() ? drv_d_func()->hEnv : 0;}
                                                       ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In member function ‘void* QODBCResultPrivate::dpDbc() const’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:210:49: error: ‘drv_d_func’ was not declared in this scope
           SQLHANDLE dpDbc() const { return drv_d_func() ? drv_d_func()->hDbc : 0;}
                                                       ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In member function ‘bool QODBCResultPrivate::isStmtHandleValid()’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:228:42: error: ‘drv_d_func’ was not declared in this scope
           return disconnectCount == drv_d_func()->disconnectCount;
                                                ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In member function ‘void QODBCResultPrivate::updateStmtHandleState()’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:233:34: error: ‘drv_d_func’ was not declared in this scope
           disconnectCount = drv_d_func()->disconnectCount;
                                        ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In constructor ‘QODBCResult::QODBCResult(const QODBCDriver*)’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:959:51: error: no matching function for call to ‘QSqlResult::QSqlResult(QODBCResultPrivate&)’
           : QSqlResult(*new QODBCResultPrivate(this, db))
                                                         ^
      In file included from /usr/include/x86_64-linux-gnu/qt5/QtSql/5.5.1/QtSql/private/qsqlresult_p.h:51:0,
                       from ../../../sql/drivers/odbc/qsql_odbc.cpp:59:
      /usr/include/x86_64-linux-gnu/qt5/QtSql/qsqlresult.h:69:5: note: candidate: QSqlResult::QSqlResult(QSqlResultPrivate&, const QSqlDriver*)
           QSqlResult(QSqlResultPrivate &dd, const QSqlDriver *db);
           ^
      /usr/include/x86_64-linux-gnu/qt5/QtSql/qsqlresult.h:69:5: note:   candidate expects 2 arguments, 1 provided
      /usr/include/x86_64-linux-gnu/qt5/QtSql/qsqlresult.h:68:14: note: candidate: QSqlResult::QSqlResult(const QSqlDriver*)
           explicit QSqlResult(const QSqlDriver * db);
                    ^
      /usr/include/x86_64-linux-gnu/qt5/QtSql/qsqlresult.h:68:14: note:   no known conversion for argument 1 from ‘QODBCResultPrivate’ to ‘const QSqlDriver*’
      ../../../sql/drivers/odbc/qsql_odbc.cpp: In member function ‘virtual bool QODBCResult::exec()’:
      ../../../sql/drivers/odbc/qsql_odbc.cpp:1464:36: error: ‘class QODBCResultPrivate’ has no member named ‘drv_d_func’
                       int precision = d->drv_d_func()->datetime_precision - 20; // (2
                                          ^
      ../../../sql/drivers/odbc/qsql_odbc.cpp:1480:42: error: ‘class QODBCResultPrivate’ has no member named ‘drv_d_func’
                                             d->drv_d_func()->datetime_precision,
                                                ^
      Makefile:463: recipe for target '.obj/qsql_odbc.o' failed
      make: *** [.obj/qsql_odbc.o] Error 1
  
  </pre>