I've upgraded from Ubuntu 18.04 to 20.04 and besides some nasty grub
issues most things worked out of the box. But my QtCreator (Qt Creator 4.11.0, Based on Qt 5.12.8 (GCC 9.3.0, 64 bit)
) is facing problems recognizing included libraries. It's showing thousands of error messages in projects that have worked perfectly fine before the update. The error messages all look like linker error messages. Some examples:
error: 'std::string' (aka 'int') is not a class, namespace, or enumeration
error: no matching function for call to 'getline'
error: member reference base type 'std::ifstream' (aka 'int') is not a structure or union
error: no template named 'vector' in namespace 'std'
error: unknown type name 'SystemCallFactory' //this class is from the same project
And even some errors in the qt and std libraries:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1374: passing argument to parameter 's' here
/usr/include/c++/8/ostream:41: candidate found by name lookup is 'std'
- The problem occurs in both cmake and qmake projects
- I do have (and need) different gcc and g++ versions installed (9 and 8) (reinstalled both after the update as the update-alternatives settings were broken and one dependency was upgraded from 6 to 8)
When I create a new project in QtCreator without changing anything from the default code, it's the same:
/home/$me/src/untitled/main.cpp:7: error: variable has incomplete type 'QApplication'`
/home/$me/src/untitled/main.cpp:8: error: unknown type name 'MainWindow'
Installed compilers:
update-alternatives --display gcc
gcc - auto mode link best version is /usr/bin/gcc-8 link currently points to /usr/bin/gcc-8 link gcc is /usr/bin/gcc /usr/bin/gcc-8 - priority 30 /usr/bin/gcc-9 - priority 20update-alternatives --display g++ g++ - auto mode link best version is /usr/bin/g++-8 link currently points to /usr/bin/g++-8 link g++ is /usr/bin/g++ /usr/bin/g++-8 - priority 30 /usr/bin/g++-9 - priority 20
I can still build all projects manually, again both cmake and qmake work here. Also, when I have a complete build in the build directory that's set in QtCreator, QtCreator will build my projects, even when I change something. It will still show the errors all over my code and in the issues
section, but will build and run anyways, so the build commands should be fine. But when the build directory is empty, it will fail.
How can I approach this problem further?
Same issue here, same solution as @nou. QtCreator 4.11 still relies on clang-8, but on Ubuntu 20.04 apt will install clang-10. The following solved the problem for me:
Install clang 8
Update the alternatives
I had no need to re-install QtCreator.
I am not 100% sure that this is same problem but I solved it by installing clang-8 package. I think problem is that qtcreator code model plugin use libclang1-8 but clang-10 get installed by default.
It seems like Qt Creator 4.15.1 is again conflicting with it's default configured kits.
So I have made a custom one by:
Using this kit cmake and Qmake is working and also missing stl and std paths are fixed.