-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi,
thank you for this great library. We use it for some time now with MinGW 11 (gcc 11.2) with the qmake config option C++17. Now we switched to MSVC19 compiler an see build issues. The only way to fix these issues is to switch to C++20 for MSVC.
On the project page you write "This library requires C++11." Is this still valid?
This is the code that triggers the compiler error for MSVC:
void CDatabaseConnectionDialog::onCheckConnectionClicked()
{
auto DbDescr = databaseDescriptor();
QDeferred<QString> DeferredResult;
d->ui.statusFrame->setState(CInputStatusWidget::ProcessingState, tr("Checking database connection - please wait..."));
d->ui.statusFrame->show();
d->ui.connectButton->setEnabled(false);
QApplication::setOverrideCursor(Qt::WaitCursor);
d->Worker.execInThread([DeferredResult, DbDescr]() mutable {
{
auto DB = QSqlDatabase::addDatabase(DbDescr.m_Driver, "ConnectionCheck");
DbDescr.apply(DB);
bool Result = DB.open();
QString Message = tr("Database connection successful");
if (!Result)
{
Message = DB.lastError().text();
DeferredResult.reject(Message);
}
else
{
DeferredResult.resolve(Message);
}
}
QSqlDatabase::removeDatabase("ConnectionCheck");
});
DeferredResult
.fail([this](QString res) {
this->setConnectionCheckResult(false, res);
})
.done([this](QString res) {
this->setConnectionCheckResult(true, res);
});
}An this is the error:
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(680): error C2059: syntax error: ';'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(661): note: while compiling class template member function 'QDeferredData<QString>::DeferredAllCallbacks *QDeferredData<QString>::getCallbacksForThread(void)'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(249): note: see reference to function template instantiation 'QDeferredData<QString>::DeferredAllCallbacks *QDeferredData<QString>::getCallbacksForThread(void)' being compiled
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(194): note: while compiling class template member function 'QDeferredData<QString>::QDeferredData(void)'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferred.hpp(146): note: see reference to function template instantiation 'QDeferredData<QString>::QDeferredData(void)' being compiled
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferred.hpp(147): note: see reference to class template instantiation 'QDeferredData<QString>' being compiled
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferred.hpp(144): note: while compiling class template member function 'QDeferred<QString>::QDeferred(void)'
..\..\..\src\qtlabb\database\DatabaseConnectionDialog.cpp(296): note: see reference to function template instantiation 'QDeferred<QString>::QDeferred(void)' being compiled
..\..\..\src\qtlabb\database\DatabaseConnectionDialog.cpp(296): note: see reference to class template instantiation 'QDeferred<QString>' being compiled
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(681): error C2143: syntax error: missing ';' before '}'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(681): error C2059: syntax error: '}'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(683): error C2059: syntax error: 'return'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(684): error C2059: syntax error: '}'
C:\CodingXP\msvc19_64_qt6\usr\include\QDeferred\qdeferreddata.hpp(684): error C2143: syntax error: missing ';' before '}'
When using MinGW with C++17 or when switching to C++20 for MSVC19 compiler, the code compiles fine. That would indicate, that C++ 20 is required instead of C++11.
Metadata
Metadata
Assignees
Labels
No labels