How to change default C++ version for Creator projects
-
wrote on 5 Feb 2024, 14:19 last edited by
Was an idle curiosity, now irritating me that I can't spot answer.
Using Qt 5.15, Qt Creator 6, as supplied for Ubuntu 22.04.
I use qmake. When Creator creates a new project for me the
project.pro
containsCONFIG += c++11
.Where does that C++ version choice for new projects come from? Googling
qt change default c++ version
has not showed me where it's stored or how to alter it. Don't know whether Creator might put this in or have a setting (can't see one, tried looking all over) or whether it's some default from qmake?My gcc version is 11.4. I believe I can go to
c++14
orc++17
fine. I create lots of tiny test projects frequently, I don't want to have to think to change the.pro
each time. Preferably a solution which is for end-user, I don't want to alter a system-installed Qt file. -
Was an idle curiosity, now irritating me that I can't spot answer.
Using Qt 5.15, Qt Creator 6, as supplied for Ubuntu 22.04.
I use qmake. When Creator creates a new project for me the
project.pro
containsCONFIG += c++11
.Where does that C++ version choice for new projects come from? Googling
qt change default c++ version
has not showed me where it's stored or how to alter it. Don't know whether Creator might put this in or have a setting (can't see one, tried looking all over) or whether it's some default from qmake?My gcc version is 11.4. I believe I can go to
c++14
orc++17
fine. I create lots of tiny test projects frequently, I don't want to have to think to change the.pro
each time. Preferably a solution which is for end-user, I don't want to alter a system-installed Qt file.@JonB You can search for the templates used by QtCreator.
For example I found /usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro for QtCreator packaged by Ubuntu.
It could also be that QtCreator sets the min C++ version required by the used Qt version to support as many compilers/versions as possible. -
@JonB You can search for the templates used by QtCreator.
For example I found /usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro for QtCreator packaged by Ubuntu.
It could also be that QtCreator sets the min C++ version required by the used Qt version to support as many compilers/versions as possible.wrote on 5 Feb 2024, 14:37 last edited by JonB 2 May 2024, 14:37@jsulm said in How to change default C++ version for Creator projects:
For example I found
/usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro
for QtCreator packaged by Ubuntu.Will do. I was hoping not to have to alter a system file, for example maybe Creator initially creates something in
~/whatever
where I could find thec++11
, but not having much luck. @J-Hilk suggested~/.config/QtProject ~/.local/share/data/QtProject/qtcreator1
, found some files in former, not spotted if that has anything for this issue.It's kind of strange nobody has ever asked this. Wanting to up the default C++ for projects is not unreasonable.
-
@JonB You can search for the templates used by QtCreator.
For example I found /usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro for QtCreator packaged by Ubuntu.
It could also be that QtCreator sets the min C++ version required by the used Qt version to support as many compilers/versions as possible.wrote on 5 Feb 2024, 14:45 last edited by JonB 2 May 2024, 14:45@jsulm said in How to change default C++ version for Creator projects:
For example I found
/usr/share/qtcreator/templates/wizards/projects/consoleapp/file.pro
for QtCreator packaged by Ubuntu.OK, since that's clearly a literal
.pro
file and it has hard-codedCONFIG += c++11 console
that is clearly the correct answer! I had thought thec++11
would be "generated" from somewhere during project creation, but looks like it was set in whenever Qt was generated/released. Ho hum. Prefer not to alter the system files, will live with having to alter it in generated.pro
file. At least I know! -
-
1/4