c++ - 编译时得到错误: 'QtGui/QAction' file not found #include <QtGui/QAction>

标签 c++ macos qt

我刚刚安装了 Mac OS X 10.8.3 和 Qt Creator 3、XCode 和 XCode 命令行工具。我正在尝试编译一个在另一台计算机上运行的项目,但每次我去“全部构建”时,我都会得到 error: 'QtGui/QAction' file not found#include <QtGui/QAction>

我尝试在 .pro 文件中添加第二行和第三行,但没有帮助

QT       += core gui opengl
CONFIG += qt
QT += gui
TARGET = BasicOpenGL
TEMPLATE = app

更新:我也试过这个 .pro 文件,但它没有用

QT       += core gui opengl
QT += widgets
TARGET = BasicOpenGL
TEMPLATE = app

我应该说这是我第一次尝试在 mac 上进行开发。

从 Qt 编译输出

Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I. -F/Users/john/Qt/5.2.0/clang_64/lib -o mainwindow.o ../Framework/mainwindow.cpp
In file included from ../Framework/mainwindow.cpp:2:
../Framework/ui_mainwindow.h:14:10: fatal error: 'QtGui/QAction' file not found
#include <QtGui/QAction>
         ^
1 error generated.
make: *** [mainwindow.o] Error 1
15:51:32: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project BasicOpenGL (kit: Desktop Qt 5.2.0 clang 64bit)
When executing step 'Make'

更新:我让它工作了,但随着所有的麻烦,我不确定是什么导致了它。我从一个新的 mac 镜像开始,安装系统更新,安装 xcode,安装 xcode 命令行工具,安装 QT Creator 3.0,安装 QT 库 4.8.1,在 QT Creator 中设置编译器。

最佳答案

尝试执行 make clean,然后执行 make。我在 Windows 7 系统上遇到了这个问题,这对我有用。

关于c++ - 编译时得到错误: 'QtGui/QAction' file not found #include <QtGui/QAction>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21551557/

相关文章:

c++ - Visual Studio 2017 允许在构造函数中使用自身初始化引用成员。它真的是合法的 C++ 吗?

c++ - 函数在不应该的时候突然返回

C++ double to hex console output need help in resolving

c++ - 如何在窗口中显示文件夹中所有文件的名称? Qt C++

c++ - 返回带槽的数据

c++ - 如何增加在堆栈/堆上分配的最大内存

ios - 在 Mac 上通过 USB 访问 iOS 设备

macos - 在 OSX Sierra 中使用专有编解码器支持构建 CEF

cocoa - 为什么这个应用程序不能在 PowerPC G4 上运行

qt - (PyQt) QTreeView - 想要展开/折叠所有子项和孙项