PDA

View Full Version : QtCreator can't find Qt + failed uninstall of earlier version



MattPhillips
14th March 2011, 00:56
I've gone through a number of versions of Qt and have only had this problem with 4.7+. When I try to compile previously working programs in QtCreator, I get 'QtGui/QApplication: No such file or directory' errors for all the Qt library files I'm using. I do not get these errors for programs installed within the Qt directory itself--e.g. the demos compile and run just fine--but naturally most of my programs aren't installed there.

Obviously, this is a path issue, but I haven't been able to resolve it by changing System Environment variable values. My PATH variable contains


/usr/local/Trolltech/Qt-4.7.1/bin

along with the default path items; adding the directory to which I installed Qt,


~/qt-everywhere-opensource-src-4.7.1 (/include or /bin)

doesn't help things. Modifying INCLUDEPATH in the .pro file doesn't help either.

Probably not related, but in addition QtCreator is still 'finding' Qt 4.6.2 even though I have installed it and deleted its files from /usr/lib. Anybody know how to get rid of this (as well as how to solve the main problem)?

MattPhillips
14th March 2011, 03:19
Update: So I got the default QtGui application to work, but here's what it took (added to the .pro file):


LIBS += -L/home/matt/qt-everywhere-opensource-src-4.7.1/lib -lQtGui \
-L/usr/local/Trolltech/Qt-4.7.1/lib -lQtGui
INCLUDEPATH += /home/matt/qt-everywhere-opensource-src-4.7.1/include \
/home/matt/qt-everywhere-opensource-src-4.7.1/include/QtGui

However isn't sufficient for larger programs, they need many more libraries besides QtGui; and this would have to be created anew for each platform. So surely this isn't the right way out of the problem, nor is building all my programs within the Qt directory... so what can I do?

MattPhillips
18th March 2011, 04:20
Another update: I went into the Makefile (for the default QtGui application I created, "asdf") and found


INCPATH = -I/usr/local/Trolltech/Qt-4.7.1/mkspecs/linux-g++-64 -I../asdf -I/home/matt/include/QtCore -I/home/matt/include/QtGui -I/home/matt/include -I.moc/release-shared -I.uic/release-shared -I.
LIBS = $(SUBLIBS) -L/home/matt/lib -lQtGui -lQtCore -lpthread

What's weird is that neither of /home/matt/lib or /home/matt/include exist. /home/matt is (obviously) my home directory, and it's the directory into which I installed Qt (qt-everywhere-opensource-src-4.7.1), i.e., that's the directory the Qt folder is in. I did *at one point* have these folders in my home directory, when I was using an earlier version, maybe the same version that didn't fully delete; I'm not sure why they were there, perhaps I installed into the home directory directly by mistake.

Lastly, I tried changing the HOME and PATH environment variables from /home/matt (default) to /home/matt/qt-everywhere-opensource-src-4.7.1, but it didn't change anything.

Anyway, anybody know how I can get qmake to generate correct INCPATH and INCLUDE values?

Matt
Matt

Rhayader
18th March 2011, 09:20
First suggestion is you should delete the project's .pro.user file which saves the project's information. Qtcreator will create it again.
Also since you changed Qt version try to do the "make clean" - "qmake" steps if you haven't done it already.
Check the Tools-->Options-->Qt4 in Qtcreators menu. Maybe you can delete the obsolete versions.
Last I'm not sure if it helps but maybe you should check the Trolltech.conf file in ~/.config directory.

MattPhillips
19th March 2011, 01:57
Hi Rhayader,

Thanks for your ideas. Deleting the .pro.user file didn't help, and redoing qmake, clean etc. ad infinitum didn't change anything either. The obsolete versions can't be deleted from Tools->Options->Qt4. I did not know/had forgotten about the ~/.config directory, thanks. I couldn't really make heads or tails of the Trolltech.conf file; I found references to older versions but didn't know what I should/shouldn't cut. I also find a Nokia/QtCreator.ini file which let me take out the obsolete Qt versions; but I couldn't find anything anywhere that let me change where Qt looks by default for libraries and files. I even reinstalled QtCreator into the Qt directory (instead of into the home directory), this didn't change anything.

MattPhillips
20th March 2011, 19:19
I've filed a bug report: http://bugreports.qt.nokia.com/browse/QTBUG-18230

MattPhillips
21st March 2011, 13:35
Turns out .qmake.cache was out of date, deleting it solved the problem. See the bug report.