Qt (C++) を使い始めたばかりなので、オンラインで見つけた "hello, world" の例に従いました。ディレクトリ hello にプログラム hello.cpp を作成しました。
#include <QtGui>
int main(int argc, char *argv[]) {
QApplication app (argc, argv);
QLabel label ("Hello, world!");
label.show();
return app.exec();
}
私は走った:
qmake -project
qmake hello.pro
make
すべてが正しくコンパイルされ、./hello を実行できました。次に、冒険好きな人として、ファイルを変更してみました。
#include <QtGui>
#include <QtWebKit>
int main(int argc, char *argv[]) {
QApplication app (argc, argv);
QLabel label ("Hello, world!");
QWebPage page;
label.show();
return app.exec();
}
3 つのコマンドを再実行しましたが、make を実行すると次のエラーが表示されます。
hello.cpp:2: fatal error: QtWebKit: No such file or directory
compilation terminated.
make: *** [hello.o] Error 1
Makefile をチェックアウトしたところ、INCPATH 変数は次のように定義されていました。
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
-I/usr/include/qt4/QtWebKit が著しく欠落しています。LIBS 変数にも -lQtWebKit がありませんでした。これらを手動で追加すると、コンパイルが成功します。私は何を間違っていますか?qmake が正しい Makefile を生成するには、何を追加する必要がありますか?