Qt Creator displaying warnings related to C++98
-
I'm running Qt Creator 15.0.1 on Windows, and I'm getting warnings about incompatibilites with C++98. This is appearing as annotations in code editor.
I've added the following to the .pro file, but it didn't change any behavior
CONFIG -= c++98 CONFIG += c++11 CONFIG += c++17
How can I get the clang code model to ignore C++98 issues?
-
C Christian Ehrlicher moved this topic from General and Desktop
-
@GregB You are currently adding both
C++11
andC++17
- please choose one of them. If you use an older Qt and therefore qmake version, you might need to replaceC++17
withC++1z
Also, I doubt that
CONFIG -= c++98
has any meaning, see https://doc.qt.io/qt-6/qmake-variable-reference.html#config for known variables.If you still encounter problems, please share the code you are getting warnings with.
Regards
-
I changed the .pro file to only contain the
c++17
. The warnings that I'm getting are within Qt Creator, not from the build process. Some example warnings are below:M:\nidb\src\nidb\modulePipeline.cpp:300: warning: 'auto' type specifier is incompatible with C++98 M:\nidb\src\nidb\modulePipeline.cpp:300: warning: If initialization statements are incompatible with C++ standards before C++17 M:\nidb\src\nidb\modulePipeline.cpp:1377: warning: Initialization of initializer_list object is incompatible with C++98 M:\nidb\src\nidb\modulePipeline.cpp:1867: warning: 'auto' type specifier is incompatible with C++98 M:\nidb\src\nidb\modulePipeline.cpp:1867: warning: If initialization statements are incompatible with C++ standards before C++17 M:\nidb\src\nidb\modulePipeline.cpp:2188: warning: Universal character name referring to a control character is incompatible with C++98
-
Line 300
foreach (int sid, studyids) {
Line 1377
QStringList bidsflags = { "BIDS_SUBJECTDIR_UID", "BIDS_STUDYDIR_STUDYNUM" };
Line 1867
foreach (QString group, groups) {
I'm not sure that the code is invalid? This code builds without warnings or error. The only issue is the warnings within Qt Creator generated by clangd within the editor. I recently upgraded my computer and reinstalled Qt Creator, and that's when I started getting the warnings. I was using 15.0.1 before, and 15.0.1 now. I must have had a setting turned off on my previous computer related to clangd, but I don't know what the setting is.