Objective-C in Qt with Mavericks

前端 未结 1 2047
一个人的身影
一个人的身影 2020-12-10 18:27

I\'ve been using Objective-C mixed with C++ in Qt without any issues; using .mm files where required.

After upgrading my build machine to Mavericks, I initially noti

相关标签:
1条回答
  • 2020-12-10 18:47

    You're supposed to include the frameworks as Framework/Header.h. It seems that you've added some unnecessary includes to your project file.

    The following works for me:

    #project.pro
    TEMPLATE = app
    
    LIBS += -framework AppKit -framework Foundation
    
    OBJECTIVE_SOURCES = main.mm
    
    //main.mm
    #import <Foundation/NSUserNotification.h>
    #import <AppKit/NSApplication.h>
    #include <QCoreApplication>
    
    int main(int argc, char ** argv)
    {
       QCoreApplication a(argc, argv);
       NSApplication * app = [NSApplication sharedApplication];
       return 0;
    }
    
    0 讨论(0)
提交回复
热议问题