how to resolve error of qmutex.h?
-
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?