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 fix an error pointed to QtCore/qvector.h
Forum Updated to NodeBB v4.3 + New Features

How to fix an error pointed to QtCore/qvector.h

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 840 Views 2 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.
  • C Offline
    C Offline
    Chinh
    wrote on last edited by
    #1

    Hi,
    Using Qt 5.14.2 and RHEL 7.9 VM and got the error message below and it pointed to in the header file qvector.h in QCore.
    (/opt/Qt5.14.2/5.14.2/gcc_64/include/QtCore/qvector.h)

    Invalid initialization of non-const reference of type 'Text&'
    from an rvalue of type 'std::remove_refence<Text&>::type {aka Text}'

    Appreciate any help!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Copy and paste the whole error and the offending code. It is coming from code in your program that is manipulating objects of type Text.

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

        Also make sure you use a recent gcc - what gcc version do you use? Please also see this page - supported platforms.

        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
        • C Offline
          C Offline
          Chinh
          wrote on last edited by
          #4

          Sorry for late responses!

          I'm using gcc version 5.3.1 from devtoolset-4 as directed from the support platform page.
          The tricky & strange part is that it does not mention anything to my source code, but it just simply points to qvector.h in QtCore. How I know which part of my code has pawned this bug as QVector has been used everywhere in my program. For more info, please look at the screen shot from the output pane below.

          QVector_ErrorMessage.PNG

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mchinand
            wrote on last edited by
            #5

            Look in the 'Compile Output' pane to get more detailed information on what was being compiled that produced this error.

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

              And make sure that really gcc5 is used. I would guess it's not the case. This can also be seen in the compiler output

              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
              • C Offline
                C Offline
                Chinh
                wrote on last edited by
                #7

                Silly me! I have spotted it in the Compile Output pane. All of you guys are awesome. Thanks for spending your valuable time to answer my questions.

                1 Reply Last reply
                1
                • Roxy DrugsR Offline
                  Roxy DrugsR Offline
                  Roxy Drugs
                  Banned
                  wrote on last edited by
                  #8
                  This post is deleted!
                  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