qt - 从 C++ 导入时找不到“UIKit/UIKit.h”文件
问题描述
这是我的 .pro 文件
QT += quick
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS
TEMPLATE = app
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp \
bridgingfile.cpp
ios {
OBJECTIVE_SOURCES += ViewController.m
}
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
#QML_DESIGNER_IMPORT_PATH =
## Default rules for deployment.
#qnx: target.path = /tmp/$${TARGET}/bin
#else: unix:!android: target.path = /opt/$${TARGET}/bin
#!isEmpty(target.path): INSTALLS += target
HEADERS += \
bridgingfile.h \
ViewController.h
DISTFILES += \
ViewController.m
当我导入目标 c 文件时出现这样的错误
/Users/workspace/SimpleIOS/ViewController.h:9: error: 'UIKit/UIKit.h' file not found
我是 Qt 编程的新手,我怎么能做到这一点。请帮帮我。
提前致谢
解决方案
我认为您应该在 pro 文件中的 ios 范围内添加 UIKit 框架:
ios: { LIBS += -framework UIKit OBJECTIVE_SOURCES += ViewController.m }
推荐阅读
- ruby-on-rails - 带有Webpacker触发器的rails中的传单找不到地图容器
- python - 如何根据阈值划分列表?
- css - 预加载会阻塞整个渲染阶段
- android - java.lang.IllegalArgumentException:无法在形状为 [2] 的 TensorFlowLite 张量和形状为 [1、2] 的 Java 对象之间复制
- react-native-ui-kitten - 如何更改底部导航中选定的 BottomNavigationTab 的颜色( ui-kitten )
- xamarin - 我正在尝试在 Xamarin Android 中使用 Google ARCore sceneform SDK。但我在“ModelRenderable.InvokeBuilder().SetSource()”方法中遇到错误
- data-structures - 如何计算结果森林中一棵树的最大高度?
- javascript - 排序哈希键。获取顺序是固定的吗?
- material-ui - 如何在矩阵 UI 排版中添加更多变体
- c# - 递归继承如何工作?类 PersonInfoBuilder
: PersonBuilder where SELF : PersonInfoBuilder