我刚刚安装了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
Run Code Online (Sandbox Code Playgroud)
更新:我也试过这个.pro文件但它没有用
QT += core gui opengl
QT += widgets
TARGET = BasicOpenGL
TEMPLATE = app
Run Code Online (Sandbox Code Playgroud)
我应该说这是我第一次尝试在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'
Run Code Online (Sandbox Code Playgroud)
更新:我得到了它的工作,但所有的拧紧我不确定是什么做的.我开始使用全新的mac映像,安装了系统更新,安装了xcode,安装了xcode命令行工具,安装了QT Creator 3.0,安装了QT库4.8.1,在QT Creator中设置了编译器.
hlu*_*luk 14
在Qt5中,QAction标题位于QtWidgetsinclude子目录中,而不是QtGui(在Qt4中为真).虽然您实际上不需要指定包含子目录,因为它qmake会为您处理.您只需要添加QT += widgets到您的.pro文件中.