QT Creator not showing autocomplete for C++ methods
-
wrote on 20 Feb 2025, 19:04 last edited by Josko
Hello!
I have QT Creator 14.0.1.Regardless if I choose plain C++ or QT app, code completion does not work for pure C++ methods, e.g. from std:: .
In the screenshot example: I have created clean plain C++ app and trying to get <string>.length().
For QT stuff works OK.
As you can see: under Preferences->Text Editor->Completion the character threshold was attempted to be set to various values.
Thanks!! -
wrote on 27 Feb 2025, 20:03 last edited by Josko
I have upgraded my QT to 6.7.3 so as MSVC from 2019 to 2022 so as installed MinGW but these only partially solved the problem (std::vector started to autocomplete but std::string not).
But found out what made autocomplete to work fully: checking the box Use clangd in Clangd tab under Preferences -> C++ .
Seems it has to be done with every new project. -
Hi @Josko,
Can you actually compile (and run) this test program?
It seems you are using Windows, please tell us which compiler and which Qt version you are using (see in the Kits settings).
Regards
-
wrote on 21 Feb 2025, 10:44 last edited by Josko
-
Hi!
Compiler is MSVC2019, QT 6.7.2 .
Yes, after I manually complete str.length() not just that I can compile and run but I see correct value of length() property in debugger.
Same was the case when I tried with other pure C++ functions like e.g. those included in <vector> namespace.wrote on 21 Feb 2025, 16:15 last edited by@Josko It is surprising the program compiles but does not autocomplete.
Try to change the compiler if it will work. I am currently on Qt Creator 15.00 and Qt 6.8 using theMinGW x86 64-bit
compiler that comes bundled with Qt and it works here.You can change the compiler settings by going to Edit > preferences > Kits
This is a screenshot of the compiler tab of Kits.
If you don't have any non-MSVC compiler, you can add one using the add button.
Usually, the MinGW compiler bundled with Qt can be found in the path: .../Qt/tools/mignw{numbers}/bin/gcc.exeAfter adding it, you can set it as a default compiler in the Kits tab
-
@Josko It is surprising the program compiles but does not autocomplete.
Try to change the compiler if it will work. I am currently on Qt Creator 15.00 and Qt 6.8 using theMinGW x86 64-bit
compiler that comes bundled with Qt and it works here.You can change the compiler settings by going to Edit > preferences > Kits
This is a screenshot of the compiler tab of Kits.
If you don't have any non-MSVC compiler, you can add one using the add button.
Usually, the MinGW compiler bundled with Qt can be found in the path: .../Qt/tools/mignw{numbers}/bin/gcc.exeAfter adding it, you can set it as a default compiler in the Kits tab
@emman_fosu except for one thing: you cannot exchange Visual Studio for MinGW to build C++ code. They are not compatible so installing the matching version of Qt is mandatory if you want to ensure that you can also build.
-
wrote on 27 Feb 2025, 20:03 last edited by Josko
I have upgraded my QT to 6.7.3 so as MSVC from 2019 to 2022 so as installed MinGW but these only partially solved the problem (std::vector started to autocomplete but std::string not).
But found out what made autocomplete to work fully: checking the box Use clangd in Clangd tab under Preferences -> C++ .
Seems it has to be done with every new project. -
wrote on 27 Feb 2025, 20:13 last edited by Josko
P.S. I have noticed now some stupid X-small-font warning like: "ClangD was automatically disabled because it can consume much resources on my system bla bla..." (although have 8 Gigs and I7). Seems I somehow succeeded to remove that "fuse" even for new projects now, not sure how.
Oh God... I have developed code under Visual Studio 2008 before a decade ago with Intellisense with only 2,5 Gigs RAM ... -