开发者

Qt Creator 2.1.0 can't find Qt, looks in wrong place

I've recently installed 4.7.1 (and 4.7.2, same results) alongside QtCreator 2.1.0. When I try to compile the default (empty) QtGui application, I get 'QtGui/QApplication: No such file or directory' errors. If I and the file location to INCLUDEPATH in the .pro file, I get 'can't find -lQtGui'; if I add the library to LIBS, the program compiles and runs.

But modifying the .pro file like this really isn't a viable solution, it's very difficult for large programs for one thing, and in any case I can't believe this is what the developers intend. I've used various versions of Qt for several years now and have not had this problem.

According to the Makefile, Qt is looking for these files/libs in directories that don't exist, specifically ~/include and ~/lib ('/home/matt' is my home directory, on Ubuntu):

INCPATH = -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/linux-g++-64 -I. -I/home/matt/include/QtCore -I/home/matt/include/QtGui -I/home/matt/include -I/usr/X11R6/include -I.moc/release-shared -I.uic/release-shared

LIBS = $(SUBLIBS) -L/home/matt/lib -L/usr/X11R6/lib64 -lQtGui -lQtCore

Why i开发者_StackOverflow中文版s it trying to look in these folders? I've tried changing the HOME and even PWD system environment variables, it didn't change anything. NB Qt and QtCreator are both installed in my home directory. Does anybody know what the issue is here?

Matt

P.S. I've had this on QtCentre for awhile but haven't heard anything there.

P.P.S I've gone ahead and filed a bug report, http://bugreports.qt-project.org/browse/QTBUG-18230


The LIBS variable in the Makefile must point to the directory from the QtCreator library directory as follows :

LIBS          = $(SUBLIBS) ~/QtSDK/QtCreator/lib/qtcreator -lQtGui -lQtCore -lpthread

Then run : make


It's possible that Qt Creator hasn't detected where you installed the 4.7.x toolkits. Look in Tools->Options->Qt4 (on a Mac Preferences->Qt4) and add toolkit versions (the "+" button). What you need to identify are paths to qmake for whatever version you want to build.


http://bugreports.qt-project.org/browse/QTBUG-18230

Turns out .qmake.cache was out of date, deleting it solved the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜