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. Compile errors on macOS when using clang and c++17 in a Qt 5.15 project
Forum Updated to NodeBB v4.3 + New Features

Compile errors on macOS when using clang and c++17 in a Qt 5.15 project

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 887 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.
  • DuBuD Offline
    DuBuD Offline
    DuBu
    wrote on last edited by
    #1

    Hi all,

    I try to compile a Qt 5.15 qmake project with clang and c++17 under macOS 13.3. I get a lot of errors which are probably related to the same reason. So the first error I get is

    no member named 'auto_ptr' in namespace 'std'
    

    The compiler next gets called with

    clang++ -stdlib=libc++ -std=c++1z -arch arm64
    

    A clang++ --version call gives

    Apple clang version 14.0.3 (clang-1403.0.22.14.1)
    Target: arm64-apple-darwin22.4.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    Other projects which compile just fine with c++11 give the same errors with c++1z. But this projects uses c++17 features, so I can't switch back to c++11.

    What can I do to compile with clang and c++17 on macOS?

    Thanks!

    JonBJ 1 Reply Last reply
    0
    • DuBuD DuBu

      Hi all,

      I try to compile a Qt 5.15 qmake project with clang and c++17 under macOS 13.3. I get a lot of errors which are probably related to the same reason. So the first error I get is

      no member named 'auto_ptr' in namespace 'std'
      

      The compiler next gets called with

      clang++ -stdlib=libc++ -std=c++1z -arch arm64
      

      A clang++ --version call gives

      Apple clang version 14.0.3 (clang-1403.0.22.14.1)
      Target: arm64-apple-darwin22.4.0
      Thread model: posix
      InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
      

      Other projects which compile just fine with c++11 give the same errors with c++1z. But this projects uses c++17 features, so I can't switch back to c++11.

      What can I do to compile with clang and c++17 on macOS?

      Thanks!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @DuBu
      Are you saying it is Qt headers themselves which are causing this, or could you have std::auto_ptr in your own code? Might you be using another library like boost as well? See https://forum.qt.io/topic/121715/qt-6-0-error-no-template-named-auto_ptr-in-namespace-std-why.

      DuBuD 2 Replies Last reply
      0
      • JonBJ JonB

        @DuBu
        Are you saying it is Qt headers themselves which are causing this, or could you have std::auto_ptr in your own code? Might you be using another library like boost as well? See https://forum.qt.io/topic/121715/qt-6-0-error-no-template-named-auto_ptr-in-namespace-std-why.

        DuBuD Offline
        DuBuD Offline
        DuBu
        wrote on last edited by DuBu
        #3

        @JonB

        std::auto_ptr is in a third party library I included as a submodule in my git repo. I have also a c++11 project which uses this submodule as well, which compiles fine. But the project which needs c++17 won't compile the code from the submodule.
        No boost is used in both projects.

        1 Reply Last reply
        0
        • JonBJ JonB

          @DuBu
          Are you saying it is Qt headers themselves which are causing this, or could you have std::auto_ptr in your own code? Might you be using another library like boost as well? See https://forum.qt.io/topic/121715/qt-6-0-error-no-template-named-auto_ptr-in-namespace-std-why.

          DuBuD Offline
          DuBuD Offline
          DuBu
          wrote on last edited by
          #4

          @JonB
          Thanks for the link! I learned that std::auto_ptr is removed in c++17. So I checked the upstream repo of my submodule and they really have a commit fixing that issue. Updating the submodule fixed my issue.
          Thanks again!

          1 Reply Last reply
          2
          • DuBuD DuBu has marked this topic as solved on

          • Login

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