Compile errors on macOS when using clang and c++17 in a Qt 5.15 project
-
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 givesApple 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!
-
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 givesApple 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!
@DuBu
Are you saying it is Qt headers themselves which are causing this, or could you havestd::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. -
@DuBu
Are you saying it is Qt headers themselves which are causing this, or could you havestd::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.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. -
@DuBu
Are you saying it is Qt headers themselves which are causing this, or could you havestd::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. -
D DuBu has marked this topic as solved on