qmake无法与Qt 5.6一起使用 [英] qmake not working with Qt 5.6

查看:275
本文介绍了qmake无法与Qt 5.6一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Creator中安装了Qt 5.6.我有一个简单的Qt项目,正在尝试制作".如果我运行qmake&&在项目目录中进行搜索时,我得到以下结果:

I have installed Qt 5.6 with Creator. I have a simple Qt project which I am trying to 'make'. If I run qmake && make while in the project directory I get the following result:

qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

我在线上找到了几条建议使用以下方法为QT4安装qmake的帖子:

I found several posts online that suggested installing qmake for QT4 to resolve this, using:

sudo apt-get install qt4-qmake 

我实际上是这样做的,它似乎可以使Qmake正常工作,但是make过程因

I actually did this and it seemed to get Qmake working, but the make process failed with

make: /usr/lib/x86_64-linux-gnu/qt4/bin/moc: Command not found     
Makefile:190: recipe for target 'main.moc' 
failed make: *** [main.moc] Error 127

因此在环境中似乎找不到moc.我认为"这是因为我正在为版本4运行qmake,但实际上我安装了5.6版本的Qt.从那以后,我删除了qt4-qmake,再次出现了原始错误.

So it seems to not find moc in the environment. I "think" this is because I am running qmake for version 4 but I actually have version 5.6 of Qt installed. I have since removed qt4-qmake and i have the original error again.

所以我的问题是这样的:如果我已经安装了Qt 5.6(这是我使用的Qt库所必需的),为什么它要寻找版本4的qmake,以及如何让qmake识别我的5.6版安装?

So my question is this: if i have Qt 5.6 installed (which is required for the Qt libraries I am using), why is it looking for version 4 qmake and how can I get qmake to recognize my version 5.6 install?

因此,我可以从Qt Creator中运行qmake,但它不会在项目目录中创建makefile文件.如果我在Qt Creator中运行调试器,则可以看到Creator在哪里运行qmake和make,并且可以看到它成功.但我看不到它创建的任何文件.在Qt Creator中运行项目是否会导致创建任何文件?

So I can run qmake from within Qt Creator, but it doesnt create a makefile file in the project directory. If I run the debugger in Qt Creator, I can see where Creator runs qmake and make from and I can see it is successful. But I see no files that it creates as a result. Does running the project in Qt Creator result in any files being created, and if so where?

我在Qt Creator中的项目选项卡上更新了项目详细信息.奇怪的是,默认情况下它不会保存到那里.在Creator中运行QMake的文件会在正确的文件夹中创建文件.

I updated the project details on the project tab in Qt Creator. Strangely it doesnt save to there by default. Mow running QMake in Creator creates the file in the right folder.

推荐答案

在项目"选项卡中,是否选中了阴影生成?如果是,这就是为什么makefile不出现在项目文件夹中的原因.

In the projects tab, is shadow build ticked ? If yes, that's why the makefile doesn't appear in the project folder.

通常,您从Qt创建者那里运行qmake,因为它更加方便.

Usually you run qmake from the Qt creator because it's way more convenient.

这篇关于qmake无法与Qt 5.6一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆