XCode中编译Qt的.ui文件和带Q_OBJECT的.h文件

1、编译带Q_OBJECT的类无法自动使用moc进行编译 

解决方法(参照:xcode - 如何在Xcode中使用Q_OBJECT宏编译头文件? | 文件):

(1)选择“Build Rules”-->选择好Process和Using的类型,然后在下面的输入框输入“/Users/你的用户名/Qt/5.14.2/clang_64/bin/moc ${INPUT_FILE_PATH} -o ${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}_moc.cpp”-->在“Output Files”中输入“$(DERIVED_FILE_DIR)/${INPUT_FILE_BASE}_moc.cpp”

(2)选择“Build Phases”-->将带有Q_OBJECT的头文件加入“Compile Sources列表中”

2、XCode无法自动编译Qt的.ui文件,类似上一条

解决方法:

(1)选择“Build Rules”-->选择好Process和Using的类型,然后在下面的输入框输入“/Users/你的用户名/Qt/5.14.2/clang_64/bin/uic ${INPUT_FILE_PATH} -o ${DERIVED_FILE_DIR}/ui_${INPUT_FILE_BASE}.h”-->在“Output Files”中输入“$(DERIVED_FILE_DIR)/ui_${INPUT_FILE_BASE}.h”

(2)选择“Build Phases”-->将.ui文件加入“Compile Sources列表中”

3、添加后可能编译报错“Multiple commands produce '****/ui_LearnOpenCV.h':”,原因是工程中已经有了处理.ui文件的规则,只要将其删除即可,如下图所示

​​​​​​​

参照:IOS下XCODE10错误:Multiple commands produce解决方法

4、运行报错:vtkOpenGLRenderWindow.c:506    ERR| vtkGenericOpenGLRenderWindow (0x11a20ca80): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.

解决方法(参照:VTK8.2 QT5.13 OpenGL3.2报错Unable to find a valid OpenGL 3.2 or later implementation_养老津贴的博客-CSDN博客):在main函数中开头添加:QSurfaceFormat::setDefaultFormat(QVTKOpenGLStereoWidget::defaultFormat());

​​​​​​​

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值