I use qmake and .pro files to generate my VisualStudio .vcxproj files.
I have created a static library which contains helper functions for all my error handling. This includes wrappers for fetching error codes out of QSqlTableModel and QSqlQuery.
My library project has QT += sql in order to support these methods.
I am trying to avoid having to add the QT += sql dependency to an application which links the library but otherwise makes no use of sql.
I have passed the QSqlTableModel and QSqlQuery into the library as pointers and forward declared them so I can compile without a problem.
But I get linker errors unresolved external symbol "__declspec(dllimport) public: class QSqlError __cdecl QSqlQueryModel::lastError(void)const "
I can easily work around the linker errors by adding QT += sql to my application.
But, given that my application will never actually call this, can I just make the linker happily move on (and perhaps have the application throw a big structured exception if I ever did call it)?