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. "incompatible with C++98" warnings since Qt Creater update

"incompatible with C++98" warnings since Qt Creater update

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 7.8k Views
  • 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.
  • B Offline
    B Offline
    Bob64
    wrote on last edited by
    #1

    I was prompted to upgrade my QT Creator installation yesterday. Since then I have started getting a load of warnings in C++ code about incompatibilities with C++98 (e.g. 'auto' type specifier is incompatible with C++98). It doesn't seem to have caused any actual problems so far other than being a bit annoying.

    Anybody else seen this? Is it a bug that has been introduced or am I missing some new setting that I need to make somewhere?

    My Qt Creator is now at 4.11.0.

    aha_1980A 1 Reply Last reply
    2
    • B Bob64

      I was prompted to upgrade my QT Creator installation yesterday. Since then I have started getting a load of warnings in C++ code about incompatibilities with C++98 (e.g. 'auto' type specifier is incompatible with C++98). It doesn't seem to have caused any actual problems so far other than being a bit annoying.

      Anybody else seen this? Is it a bug that has been introduced or am I missing some new setting that I need to make somewhere?

      My Qt Creator is now at 4.11.0.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @Bob64,

      please see here

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      5
      • B Offline
        B Offline
        Bob64
        wrote on last edited by Bob64
        #3

        @aha_1980 Thank you!

        Based on information in linked threads I fixed it as follows:

        • Go to Tools -> Options -> C++ -> Code Model
        • Click Manage... on "Diagnostic configuration"
        • Click Copy... to create a new configuration copied from "Checks for questionable constructs [built in]"
        • Edit the copy to include " -Wno-c++98-compat" (i.e. should be "-Wall -Wextra -Wno-c++98-compat") and OK.
        • Back in Tools -> Options -> C++ -> Code Model ensure the new configuration is set as the Diagnostic Configuration setting.

        EDIT: I'm not sure why but when I tried to upvote @aha_1980 and mark the topic as being solved, the settings did not want to stick.

        aha_1980A oblivioncthO 2 Replies Last reply
        9
        • B Bob64

          @aha_1980 Thank you!

          Based on information in linked threads I fixed it as follows:

          • Go to Tools -> Options -> C++ -> Code Model
          • Click Manage... on "Diagnostic configuration"
          • Click Copy... to create a new configuration copied from "Checks for questionable constructs [built in]"
          • Edit the copy to include " -Wno-c++98-compat" (i.e. should be "-Wall -Wextra -Wno-c++98-compat") and OK.
          • Back in Tools -> Options -> C++ -> Code Model ensure the new configuration is set as the Diagnostic Configuration setting.

          EDIT: I'm not sure why but when I tried to upvote @aha_1980 and mark the topic as being solved, the settings did not want to stick.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi @Bob64,

          glad you solved it.

          The forum suffers from caching problems recently, therefore votes and other things may look wrong, but most often are correct.

          Regards

          Qt has to stay free or it will die.

          1 Reply Last reply
          1
          • B Bob64

            @aha_1980 Thank you!

            Based on information in linked threads I fixed it as follows:

            • Go to Tools -> Options -> C++ -> Code Model
            • Click Manage... on "Diagnostic configuration"
            • Click Copy... to create a new configuration copied from "Checks for questionable constructs [built in]"
            • Edit the copy to include " -Wno-c++98-compat" (i.e. should be "-Wall -Wextra -Wno-c++98-compat") and OK.
            • Back in Tools -> Options -> C++ -> Code Model ensure the new configuration is set as the Diagnostic Configuration setting.

            EDIT: I'm not sure why but when I tried to upvote @aha_1980 and mark the topic as being solved, the settings did not want to stick.

            oblivioncthO Offline
            oblivioncthO Offline
            oblivioncth
            wrote on last edited by
            #5

            @Bob64 said in "incompatible with C++98" warnings since Qt Creater update:

            @aha_1980 Thank you!

            Based on information in linked threads I fixed it as follows:

            • Go to Tools -> Options -> C++ -> Code Model
            • Click Manage... on "Diagnostic configuration"
            • Click Copy... to create a new configuration copied from "Checks for questionable constructs [built in]"
            • Edit the copy to include " -Wno-c++98-compat" (i.e. should be "-Wall -Wextra -Wno-c++98-compat") and OK.
            • Back in Tools -> Options -> C++ -> Code Model ensure the new configuration is set as the Diagnostic Configuration setting.

            EDIT: I'm not sure why but when I tried to upvote @aha_1980 and mark the topic as being solved, the settings did not want to stick.

            I just installed 5.14.0 on my laptop after reinstalling windows and was a few versions of Qt and creator behind. Now that I'm using 5.14.0 and Creator 4.11.0, when I opened the project I was last working on in the previous version that had no errors or warnings when compiled it was flooded with warnings like this.

            This solution got rid of all of the warnings except 4. The latter 3 aren't strictly related through phrasing I believe they are still caused by extra compiler checks that were inadvertently turned on due to what was described in the thread that @aha_1980 linked.

            • long long is incompatible with C++98
            • declaration requires an exit-time destructor
            • declaration requires a global destructor
            • declaration requires a global constructor

            I know these warnings are harmless and are just there to inform the user about potential portability (between C++ versions) and performance (the latter 3) issues but they were not present in the previous version of creator/Qt I was using (5.12.3, unsure about creator version). I did also upgrade to using MSVC2019, which may be the cause of these remaining warnings but I have no way of knowing for sure.

            Hoping someone else has figured this out.

            1 Reply Last reply
            1
            • oblivioncthO Offline
              oblivioncthO Offline
              oblivioncth
              wrote on last edited by oblivioncth
              #6

              Although I can see instance where these warnings are more helpful, the cases where its triggered for me are quite trivial an sparse in most cases so I'd rather disable them. Thanks to the clang documentation at https://clang.llvm.org/docs/DiagnosticsReference.html, I was able to get rid of the latter three with

              • -Wno-exit-time-destructors (declaration requires an exit-time destructor)
              • -Wno-global-constructors (declaration requires a global destructor & declaration requires a global constructor)

              As for the first one, while being easy to initially mistake with Wlong-long, you actually need to change this:

              --Wno-c++98-compat

              to

              --Wno-c++98-compat-pedantic

              All 4 of these extra warnings are now gone for me. The link to the clang documentation (that apparently is somewhat recent and originally was only available through a 3rd party community project on GitHub; seriously?) itself should be quite helpful to anyone who is having a similar issue.

              MucipM 1 Reply Last reply
              5
              • oblivioncthO oblivioncth

                Although I can see instance where these warnings are more helpful, the cases where its triggered for me are quite trivial an sparse in most cases so I'd rather disable them. Thanks to the clang documentation at https://clang.llvm.org/docs/DiagnosticsReference.html, I was able to get rid of the latter three with

                • -Wno-exit-time-destructors (declaration requires an exit-time destructor)
                • -Wno-global-constructors (declaration requires a global destructor & declaration requires a global constructor)

                As for the first one, while being easy to initially mistake with Wlong-long, you actually need to change this:

                --Wno-c++98-compat

                to

                --Wno-c++98-compat-pedantic

                All 4 of these extra warnings are now gone for me. The link to the clang documentation (that apparently is somewhat recent and originally was only available through a 3rd party community project on GitHub; seriously?) itself should be quite helpful to anyone who is having a similar issue.

                MucipM Offline
                MucipM Offline
                Mucip
                wrote on last edited by
                #7

                Hi @oblivioncth ,
                It worked for me too. Thanks.

                Regards,
                Mucip:)

                1 Reply Last reply
                1
                • G GregB referenced this topic on

                • Login

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