简体   繁体   English

QtCreator错误:QGroupBox:没有这样的文件或目录

[英]QtCreator Error: QGroupBox: No such file or directory

I've installed QtCreator 5.2.1 in Ubuntu and am trying to build and run an existing project that a coworker is working on. 我已经在Ubuntu中安装了QtCreator 5.2.1,并试图构建和运行一个正在工作的现有项目。 When I try to build the .pro file I receive an error "QGroupBox: No such file or directory.". 当我尝试生成.pro文件时,出现错误“ QGroupBox:无此类文件或目录。”。 I know this probably has something to do with the proper header files not being found (specifically QGroupBox.h) but am unsure how to remedy this. 我知道这可能与找不到正确的头文件有关(特别是QGroupBox.h),但不确定如何解决此问题。 I've found the proper header files, so they exist on my system I just can't figure out how to get the IDE to acknowledge them. 我找到了正确的头文件,因此它们存在于我的系统上,我只是想不通如何让IDE对其进行确认。 I'll also admit that I'm new to Linux so please bear with me... 我还要承认我是Linux的新手,所以请多多包涵...

You need to get the widgets module right as follows: 您需要正确获得小部件模块,如下所示:

QT += widgets

If you wish to have your application supported by Qt 5 as well Qt 4, you would need to use the following: 如果希望Qt 5和Qt 4支持您的应用程序,则需要使用以下内容:

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

But if you select a Widgets based application, it should have added it for you in the project file. 但是,如果您选择基于Widgets的应用程序,则它应该已经为您添加到了项目文件中。 Please double check that. 请仔细检查。

By default, the QT variable only contains core and gui . 默认情况下, QT变量仅包含coregui That was fine for Qt 4 in this case because the widgets were covered by the QtGui. 在这种情况下,这对于Qt 4很好,因为这些小部件已由QtGui覆盖。 However, that changed in Qt 5 so that you get this class and the widgets in general from their separate widgets module. 但是,这在Qt 5中有所更改,因此您通常可以从单独的小部件模块中获得此类和小部件。

You can read more upon that here . 您可以在这里阅读更多内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM