开发者

How to link Qt to and already existing MinGW installation?

When installing Qt, I unchecked the MinGW installation option as I have it already installed. Now after installing I am not able to build an example program I found in a book. All the build options in the menu are disabled.开发者_运维知识库 the code I am trying to execute is:

#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello Qt!");
    label->show();
    return app.exec();
}

When I keep the mouse pointer above the QApplication or QLabel header - the yellow pop up says "No Such File or Directory". I am using the Qt Editor.


As far as I can see your problem is in the include headers which are not visible in your build environment. You should check somewhere in the QT editor settings where to set the path to the QT library include headers.


Try the menu Help/Start Updater. In the dialog choose "Package manager", then click Next. A new dialog will open with a selection of components. Check:

"Qt SDK/Development tools/Desktop QT/Qt x.x.x (Desktop)/Desktop Qt x.x.x MinGw.

Then click Next and let it update. This will enable MinGW in Qt. Then you might have to check that the toolchain is available, by clicking on the menu:

Tool / options / Biuld & Run

Finally, if you started your project already using a different tool chain, you might want to change it to MinGW. So in the main window of Qt Creator choose the "Projects" tab on the left and select the MinGW tool chain.

Hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜