3
votes

I'm using Qt Creator and a qmake project. I have what should be a very simple problem:

#include <filesystem>
...
std::filesystem::path myPath;

During the build, as well as in the IDE, I get the error 'path is unavailable: introduced in macOS 10.15'.

I can manually compile just fine with either g++ or clang++ (without using qmake).

My qmake project file has:

TEMPLATE = app
CONFIG += c++17
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += sdk_no_version_check

Is there a magical incantation? I don't even care about the build, as this isn't even a Qt app and I have a manually-produced Makefile. I just don't want the IDE to scream errors at me.

The closest related items I can find on StackOverflow about this talk about link issues. I'm not even getting that far within Qt Creator, although I've tried various suggested flags.

--

I'm doing more digging. I'm manually editing the produced Makefile and running make and getting the same errors out of clang++. I tried g++. Same errors. But normally I build with my own manually-written Makefile, and it's compiling clean.

So I looked at the flags:

-mmacosx-version-min=10.13

Removing that manually gets rid of the error during compilation (from the command line).

So, questions:

  1. How do I get qmake to NOT put that flag in the generated Makefile?

  2. How do I get the linter to not see that flag (I assume that's why it shows up inline in the code editor portion of the IDE)?

1
in any case, take a look at: stackoverflow.com/a/49192230/5366641scopchanov
@scopchanov Qt Creator is 4.13.3, based on Qt 5.15.2. I had looked at that answer. I don't have a make problem, but an IDE problem. I'm doing the config += c++17 part.Joseph Larson
Neither of these is the version of Qt. Anyway, what do you mean by Qt Creator flags this? Where do you see the error?scopchanov
Let me explain. The IDE is not a tool by itself. It is a GUI for various tools. The solutions are different, depending on which tool is complaining. So, if you see the error in the "issues" window, it's the compiler. If you see the errors in-line - it's the linter (a static code analysis tool). From the info you have shared, my best bet would be, that either your compiler or the linter does not support C++17.scopchanov
And the solution is to add this to the .pro file: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15Joseph Larson

1 Answers

1
votes

The magical incantation I was searching for turned out to be, in the .pro file:

 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15

Without that, it was trying to build to support earlier versions of MacOS, which didn't have C++17 features yet.