Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtCreator not recognizing linked libraries after upgrading Ubuntu to 20.04
lp2020 last edited by
[Also posted on AskUbuntu without results]
I've upgraded from Ubuntu 18.04 to 20.04 via
do-release-upgrade. But my QtCreator (
Qt Creator 4.11.0, Based on Qt 5.12.8 (GCC 9.3.0, 64 bit), installed from the Ubuntu repositoies) is facing problems recognizing included libraries. It's showing hundreds 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)
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 20
update-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
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'
I can still build all projects manually, again both cmake and qmake work here, with the exact same commands that are stored in the QtCreator build section. 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
issuessection, 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?
Hi and welcome to devnet,
Did you try to nuke the Qt Creator settings ? Well rather move the settings folder somewhere else and start Qt Creator ?
lp2020 last edited by
No, partly because the QtSettings are a bit scattered and I wasn't shure which ones would be correct.
Removing and reinstalling QtCreator from Ubuntu repos didn't work, but removing and installing it via the QtUnified online installer did. Was hoping to avoid that because I didn't want to log in with an account but gave up eventually. I may try to switch back with cleaned settings at one point, but for now I'm just glad it works again.