how to resolve error of qmutex.h?
-
Application build successfully, but Error List in visual studio shows,
error from qmutex.h (C:\Qt5\5.14.0\msvc2017_64\include\QtCore\qmutex.h),
defaulted default constructor cannot be constexpr because the corresponding implicitly declared default constructor would not be constexpr
any idea why is it coming?
thanks.
-
Update to Qt 5.14.1. Also make sure your MSVC is up to date, it's quite a buggy release.
-
@nn26 did you ever resolve this error? I am getting the same bug when trying to instantiate either a QSerialPort or QSerialPortInfo object.
-
@mvonflotow said in how to resolve error of qmutex.h?:
@nn26 did you ever resolve this error? I am getting the same bug when trying to instantiate either a QSerialPort or QSerialPortInfo object.
Which Qt version? Have you updated to a later (the latest) patch release as suggested by @sierdzio?
-
And more important - what MSVC Version do you use?
-
@jlouis said in how to resolve error of qmutex.h?:
Hello everyone, I am getting the same error. I am using Qt 5.14.2 package for msvc2017, with 2019 visual studio. Any ideas?
Just the other day used that exact setup and I had no problem. Did you check what was suggested?
-
I encountered with qt5.14.2 and vs2017, and I did a little track of this problem.
it looks like the writer wanted to use some new feature of newer MSVC compiler, but actually messed up with using wrong type for Qmutex()
I solved this problem by down-graded to Qt5.13.2
-
@nitka that seems to be a regression, just check 5.12.6 source code (the one I had on hand) and QMutex is not constexpr, only the base class QBasicMutex.
But, to be honest, I don't see way QMutex should not be constexpr compatible 🤔
You should bring that to https://bugreports.qt.io/
-
@Vlad85 hi,
Please see QTBUG-85644.
-
@Vlad85 I had the exact same problem, and I too have Qt 5.15.2 installed and MSVS 2019 Community edition (32-bit).
BTW: I'm following the book by Jasmine Blanchette, which is based on Qt4, but I had made the Qt5 related updates to the best of knowledge, viz.: Added "QT += widgets" to the ".pro" file. But yet I kept getting such errors.
[To make matters worse, it so happened that I uptook a minor update on my MSVS 2019 Community edition today morning (bcoz it kept reminding me to do it upon closing the window, and I had desisted all along but finally bit the bullet and did it, and also restarted the machine as prompted). Then I began getting the errors on the spreadsheet mainWindow example of chapter 3, and I therefore wasn't sure if the build error was bcoz of the update or something else. I ran the Qt maintenance tool to see if any updates are there and it said no. Things were working fine till yesterday where I successfully built the examples in chapters 1 and 2. But after the update I began getting these errors in chapter 3 code]
Then I noticed that my CPP files had included <QtGui>. I changed that to <QtWidgets> and viola, it built fine after that.
Hope this helps.
-
-
@SocketSackett said in how to resolve error of qmutex.h?:
I too am getting this same annoying Intellisense error!
And what should we do with this? Please read the bug report and blame MS
-
@Christian-Ehrlicher In general, companies file bug reports with other companies.
-
@SocketSackett said in how to resolve error of qmutex.h?:
In general, companies file bug reports with other companies.
I don't understand - you want that TQtC fills a bug report for every IDE or compiler where completely valid code does not compile or give any other errors/warnings?