How do I add Objective C code to a FireBreath Project?

后端 未结 1 1962
独厮守ぢ
独厮守ぢ 2020-12-21 02:42

I am writing a browser plugin for Mac OS that will place a status bar icon in the status bar, which users can use to interface with the browser plugin. I\'ve successfully bu

相关标签:
1条回答
  • 2020-12-21 03:11

    Your problem is that you have .h files that are being included by C++ files that have objective c type and/or includes in them. In order to do what you want all of your classes that are used by c++ need to either keep all obj c related stuff in an #ifdef or simply not expose anything obj c in the header file.

    For example, you can use this ifdef in your header:

    #ifdef __OBJC__
         // Objective C / C++ code here
    #endif
    

    It's important to remember that .h files are includes as well as header files, so they are actually included. If you include objective c code in a .cpp file the compiler gets confused and cries.


    EDIT: The most important thing to remember is that you need to ensure that any objective c header files (or other files with objective c code) are not included from the cpp files. If you can do that you'll be fine.

    0 讨论(0)
提交回复
热议问题