Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to resolve error of qmutex.h?
Forum Updated to NodeBB v4.3 + New Features

how to resolve error of qmutex.h?

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 13 Posters 4.2k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nn26
    wrote on last edited by nn26
    #1

    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.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Update to Qt 5.14.1. Also make sure your MSVC is up to date, it's quite a buggy release.

      (Z(:^

      1 Reply Last reply
      4
      • M Offline
        M Offline
        mvonflotow
        wrote on last edited by
        #3

        @nn26 did you ever resolve this error? I am getting the same bug when trying to instantiate either a QSerialPort or QSerialPortInfo object.

        kshegunovK 1 Reply Last reply
        0
        • M mvonflotow

          @nn26 did you ever resolve this error? I am getting the same bug when trying to instantiate either a QSerialPort or QSerialPortInfo object.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @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?

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            And more important - what MSVC Version do you use?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            1
            • J Offline
              J Offline
              jlouis
              wrote on last edited by
              #6

              Hello everyone, I am getting the same error. I am using Qt 5.14.2 package for msvc2017, with 2019 visual studio. Any ideas?

              kshegunovK 1 Reply Last reply
              0
              • J jlouis

                Hello everyone, I am getting the same error. I am using Qt 5.14.2 package for msvc2017, with 2019 visual studio. Any ideas?

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #7

                @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?

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cads
                  wrote on last edited by
                  #8

                  I am also seeing this error message:
                  Visual Studio 2019, Version 16.5.4
                  Qt 5.14.2; msvc2017

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nitka
                    wrote on last edited by nitka
                    #9

                    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

                    J.HilkJ 1 Reply Last reply
                    0
                    • N nitka

                      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

                      J.HilkJ Offline
                      J.HilkJ Offline
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #10

                      @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/


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      V 1 Reply Last reply
                      0
                      • J.HilkJ J.Hilk

                        @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/

                        V Offline
                        V Offline
                        Vlad85
                        wrote on last edited by
                        #11

                        @J-Hilk I have qt 5.15.2 and still have the same issue compling with MS VS 2019

                        SGaistS V 2 Replies Last reply
                        1
                        • V Vlad85

                          @J-Hilk I have qt 5.15.2 and still have the same issue compling with MS VS 2019

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Vlad85 hi,

                          Please see QTBUG-85644.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1
                          • V Vlad85

                            @J-Hilk I have qt 5.15.2 and still have the same issue compling with MS VS 2019

                            V Offline
                            V Offline
                            vharihar
                            wrote on last edited by
                            #13

                            @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.

                            1 Reply Last reply
                            3
                            • S Offline
                              S Offline
                              SocketSackett
                              wrote on last edited by
                              #14

                              Hi,

                              I too am getting this same annoying Intellisense error!

                              DefaultedConstructerCantBeConstExpr.jpg

                              Christian EhrlicherC 1 Reply Last reply
                              0
                              • S SocketSackett

                                Hi,

                                I too am getting this same annoying Intellisense error!

                                DefaultedConstructerCantBeConstExpr.jpg

                                Christian EhrlicherC Offline
                                Christian EhrlicherC Offline
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @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

                                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                Visit the Qt Academy at https://academy.qt.io/catalog

                                S 1 Reply Last reply
                                0
                                • Christian EhrlicherC Christian Ehrlicher

                                  @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

                                  S Offline
                                  S Offline
                                  SocketSackett
                                  wrote on last edited by
                                  #16

                                  @Christian-Ehrlicher In general, companies file bug reports with other companies.

                                  Christian EhrlicherC 1 Reply Last reply
                                  0
                                  • S SocketSackett

                                    @Christian-Ehrlicher In general, companies file bug reports with other companies.

                                    Christian EhrlicherC Offline
                                    Christian EhrlicherC Offline
                                    Christian Ehrlicher
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @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?

                                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                    Visit the Qt Academy at https://academy.qt.io/catalog

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved