Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Having trouble setting up MSVC for project in QT Creator
Forum Updated to NodeBB v4.3 + New Features

Having trouble setting up MSVC for project in QT Creator

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
8 Posts 3 Posters 5.4k Views 1 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.
  • Q Offline
    Q Offline
    Qbone
    wrote on 16 Nov 2021, 16:42 last edited by
    #1

    Hi!

    Im trying to get MSVC working for an example project in QT Creator, since it uses the bluetooth module. I think I've gotten the right compiler installed now, but when I try to build the project i get this error:
    "C:\Qt\6.2.1\msvc2019_64\include\QtCore\qglobal.h:94: error: C1189: #error: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler.""

    Where can I set this option? I read somewhere that I should set it in Visual Studios project settings, but that doesn't make sense since I have no project there.

    Thankful for any replies, feels like I'm missing something basic.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JoeCFD
      wrote on 16 Nov 2021, 16:51 last edited by JoeCFD
      #2

      if you use pro file, add this
      CONFIG += c++17
      if your use cmake, add this
      set(CMAKE_CXX_STANDARD 17)

      C++17 is needed for Qt-6.0 and above.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        Qbone
        wrote on 16 Nov 2021, 17:02 last edited by
        #3

        Thanks for the quick reply, but that unfortunately doesn't seem to make any difference. I'll attach some pictures regarding the kit/compilers if that might show what I've screwed up. When I use the compiler "Microsoft Visual C++ compiler 16.x.x.x.x.(amd64)", the kit doesn't display any warnings at least. When I use "Microsoft Visual C++ compiler 17.x.x.x.(amd64)", the compiler shows the warning as displayed in the other picture.

        compilers.PNG kits.png

        J 1 Reply Last reply 16 Nov 2021, 17:36
        0
        • Q Qbone
          16 Nov 2021, 17:02

          Thanks for the quick reply, but that unfortunately doesn't seem to make any difference. I'll attach some pictures regarding the kit/compilers if that might show what I've screwed up. When I use the compiler "Microsoft Visual C++ compiler 16.x.x.x.x.(amd64)", the kit doesn't display any warnings at least. When I use "Microsoft Visual C++ compiler 17.x.x.x.(amd64)", the compiler shows the warning as displayed in the other picture.

          compilers.PNG kits.png

          J Offline
          J Offline
          JoeCFD
          wrote on 16 Nov 2021, 17:36 last edited by JoeCFD
          #4

          @Qbone said in Having trouble setting up MSVC for project in QT Creator:

          Microsoft Visual C++ compiler 17

          it does have some effect. Your original problem is gone. But you got a new error(not warning) which is something else.

          1 Reply Last reply
          0
          • C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 16 Nov 2021, 17:47 last edited by Christian Ehrlicher
            #5

            You need MSVC2017 or higher but you only have some ancient ones (MSVC 2012 and below when I would have to guess from the cl.exe version numbers)

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

            Q 1 Reply Last reply 16 Nov 2021, 18:07
            0
            • C Christian Ehrlicher
              16 Nov 2021, 17:47

              You need MSVC2017 or higher but you only have some ancient ones (MSVC 2012 and below when I would have to guess from the cl.exe version numbers)

              Q Offline
              Q Offline
              Qbone
              wrote on 16 Nov 2021, 18:07 last edited by
              #6

              @Christian-Ehrlicher Ah, thought I had installed a somewhat recent version of MSVC, where do I go about finding a download? In the Visual Studio installer (Visual Studio Community 2019), I've downloaded what I thought was the recent version of the compiler (see picture). Am I supposed to download it some other way?
              Thanks for the help!
              vs_installer.PNG

              1 Reply Last reply
              0
              • C Online
                C Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 16 Nov 2021, 18:10 last edited by Christian Ehrlicher
                #7

                The you should add this compiler in the Compilers tab in QtCreator as explained in the documentation.
                The lastest compiler is shipped with Visual Studio 2019, you're using Visual Studio 2017

                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
                • Q Offline
                  Q Offline
                  Qbone
                  wrote on 16 Nov 2021, 18:31 last edited by
                  #8

                  Hi, thanks once again for the help. Is not Visual Studio Community 2019 (the one I have installed) part of Visual Studio 2019?

                  Anyways, using the compiler named "Default LLVM 64 bit based on MSVC2019" seemed to do the trick, I thought I had to use one of the ones names "c++ compiler". The example bluetooth project can now run correctly, thanks a bunch for the help everyone! Marking this thread as Solved.

                  1 Reply Last reply
                  0

                  5/8

                  16 Nov 2021, 17:47

                  • Login

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