C++ QtCreator:找不到有效的套件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26499404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
QtCreator: No valid kits found
提问by Agrim Pathak
Installed just the IDE on Windows 7. I want to create a Plain C++ Project (Non-QT Project); however I get an error: No valid kits found. When I click on Options->Kits, I see the Desktop (default)kit, and it shows no errors.
在 Windows 7 上只安装了 IDE。我想创建一个普通的 C++ 项目(非 QT 项目);但是我收到一个错误:找不到有效的套件。当我单击 Options->Kits 时,我看到了桌面(默认)套件,它没有显示任何错误。
Am I getting the error because I didn't install a Qt library? If so, is there any way I can bypass downloading/installing that and just use the IDE?
我收到错误是因为我没有安装 Qt 库吗?如果是这样,有什么方法可以绕过下载/安装而只使用 IDE?
采纳答案by Agrim Pathak
Found the issue. Qt Creator wants you to use a compiler listed under one of their Qt libraries. Use the Maintenance Tool to install this.
发现问题。Qt Creator 希望您使用在其 Qt 库之一下列出的编译器。使用维护工具来安装它。
To do so:
这样做:
Go to Tools -> Options.... Select Build & Run on left. Open Kits tab. You should have Manual -> Desktop (default) line in list. Choose it. Now select something like Qt 5.5.1 in PATH (qt5) in Qt version combobox and click Apply button. From now you should be able to create, build and run empty Qt project.
转到工具 -> 选项...。选择左侧的构建和运行。打开套件选项卡。您应该在列表中有手动 -> 桌面(默认)行。选择它。现在在 Qt 版本组合框中的 PATH (qt5) 中选择类似 Qt 5.5.1 的内容,然后单击应用按钮。从现在开始,您应该能够创建、构建和运行空的 Qt 项目。
回答by mmdanziger
Though OP is asking about Windows, this error also occurs on Ubuntu Linux and Google lists this result first when you search for the error"QtCreator: No valid kits found".
尽管 OP 正在询问 Windows,但在 Ubuntu Linux 上也会出现此错误,当您搜索错误“QtCreator:未找到有效工具包”时,Google 会首先列出此结果。
On Ubuntu this is solved by running:
在 Ubuntu 上,这是通过运行来解决的:
For Qt5:
对于 Qt5:
sudo apt-get install qt5-default
For Qt4:
对于 Qt4:
sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui
This question is answered hereand here, though those entries are less SEO-friendly...
回答by Joseph Tankoua
No valid Kits found.The problem occur because qt-creator don't know the versions of your qt, your compiler, or your debugger. For this let's solve the Qt versions. It may normally solve the other ;).
找不到有效的套件。出现问题是因为 qt-creator 不知道您的 qt、编译器或调试器的版本。为此,让我们解决 Qt 版本。它通常可以解决另一个;)。
You try to create a new project, run select a kit and then there is no kit available in the list.
您尝试创建一个新项目,运行选择一个套件,然后列表中没有可用的套件。
Follow the steps:
按照步骤:
- execute in your terminal the command: sudo apt-get install qt5-defaultto install qt version 5.
- Verify the versionof your Qt and the locationof your qmake file. Do this by executing in your terminal the command qmake --version. You may have a result similar to this line. QMake version 3.1 Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu. What's important here is the location /usr/lib/x86_64-linux-gnu.
- Open your Qt-creator.
- Go to "Tools>Options" or "Outils>Options"
- Select the Qt Versionscombobox and select and click "Add" or "Ajouter"
- Then find the qmake file in the location of step 2. Here /usr/lib/x86_64-linux-gnu/qt5/bin/here you have the qmake file for qt5. Open it, click Apply.
- Go to "Kits" combobox. Select Desktop(by default) or Desktop(par défaut). Then scroll down to the button to select Qt version: and list down to select the version you just add. 8.Then apply all. Check your compiler and debugger and it's ok. You're done.
- 在终端中执行命令:sudo apt-get install qt5-default安装 qt 版本 5。
- 验证版本你的Qt和位置您的qmake的文件。通过在终端中执行命令qmake --version来做到这一点。您可能会得到与此行类似的结果。 QMake 3.1 版在 /usr/lib/x86_64-linux-gnu 中使用 Qt 5.9.5 版。这里重要的是位置/usr/lib/x86_64-linux-gnu。
- 打开你的 Qt-creator。
- 转到“工具>选项”或“工具>选项”
- 选择Qt 版本组合框并选择并单击“添加”或“Ajouter”
- 然后在第2步的位置找到qmake文件。这里/usr/lib/x86_64-linux-gnu/qt5/bin/这里你有 qt5 的 qmake 文件。打开它,点击应用。
- 转到“套件”组合框。选择桌面(默认)或桌面(默认)。然后向下滚动到按钮以选择 Qt version: 并向下列出以选择您刚刚添加的版本。8.然后全部应用。检查你的编译器和调试器,没问题。你完成了。
Yes I ...
是的,我 ...
Hope it's help ;)
希望它有帮助;)
回答by abcoep
In my case the issue was that my default kit's Qt version
was None
.
就我而言,问题是我的默认套件Qt version
是None
.
Go to Tools -> Options... -> Build & Run -> Kits
tab, click on the kit you want to make as default and you'll see a list of fields beneath, one of which is Qt version
. If it's None
, change it to one of the versions available to you in the Qt versions
tab which is just next to the Kits
tab.
转到Tools -> Options... -> Build & Run -> Kits
选项卡,单击要设为默认的套件,您将在下方看到一个字段列表,其中一个是Qt version
. 如果是None
,请将其更改为Qt versions
选项卡旁边的Kits
选项卡中可供您使用的版本之一。
回答by Archit Goel
For QT 5.* if you face error at Kits, like No Valid Kits Found
, go to Options->Build&Run->(Kits tab) then you see a Manual category which should list Desktop as the default.
对于 QT 5.*,如果您在 Kits 中遇到错误,例如No Valid Kits Found
,请转到Options->Build&Run->(Kits 选项卡),然后您会看到一个 Manual 类别,该类别应将 Desktop 列为默认值。
Just go to your OS Terminal and write sudo apt-get install qt5-default
, go back to QT Creator and Start your New Project, and there you see the kit option Desktop included in the list.
只需转到您的操作系统终端并编写sudo apt-get install qt5-default
,返回 QT Creator 并启动您的新项目,您就会看到列表中包含的套件选项桌面。
回答by Amr
Another way to solve this issue (I did it on Ubuntu 16.04 but it might also work for windows and other Ubuntu versions):
解决此问题的另一种方法(我是在 Ubuntu 16.04 上完成的,但它也可能适用于 Windows 和其他 Ubuntu 版本):
While going through the installation steps, when you reach the step where you choose which packages to install via check boxes, instead of just pressing next with the default "Tools" checkbox selected also check the box for the version of QT you would like in addition to the "Tools" box. I usually check the first box which is the latest version of QT.
在完成安装步骤时,当您到达通过复选框选择要安装的软件包的步骤时,不要在选中默认的“工具”复选框的情况下按下一步,还要选中您想要的 QT 版本的框到“工具”框。我通常选中第一个框,即最新版本的 QT。
After doing this you should not see the "no valid kits found" issue described in this thread.
执行此操作后,您不应看到此线程中描述的“未找到有效套件”问题。
Happy Coding.
快乐编码。