获得UIKit / UIKit.h'从c ++导入时找不到文件

时间:2018-05-10 11:55:00

标签: qt

这是我的.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编程的新手,我怎样才能实现这一目标。 请帮帮我。

提前致谢

1 个答案:

答案 0 :(得分:0)

我认为您应该在pro文件的ios范围内添加UIKit框架:

ios: {   LIBS += -framework UIKit   OBJECTIVE_SOURCES +=  ViewController.m }