I am writing a browser plug-in for Mac OS that places a status bar icon in a status bar that users can use to interact with a browser plug-in. I have successfully built the FireBreath 1.6 project in Xcode 4.4.1 and can install it in a browser. However, FireBreath uses C ++, while most of the existing libraries for Mac OS are written in Objective C.
In the /Mac/projectDef.make file, I added the Cocoa Framework and Foundation Framework, as suggested here , and in other resources that I found on the Internet:
target_link_libraries(${PROJECT_NAME} ${PLUGIN_INTERNAL_DEPS} ${Cocoa.framework} # added line ${Foundation.framework} # added line )
I reran prepmac.sh, expecting a new project to be created in Xcode with my .mm and .m files; however, they seem to be ignored. I only see .cpp and .h files. I added rules for those found in the projectDef.make file, but it doesn't seem to matter:
file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Mac/[^.]*.cpp Mac/[^.]*.h Mac/[^.]*.m
Even if I add the files manually, I get a number of compilation errors. There are about 20 of them, all associated with the NSObjRuntime.h file:
Parse Issue - Expected unqualified-id Parse Issue - Unknown type name 'NSString' Semantic Issue - Use of undeclared identifier 'NSString' Parse Issue - Unknown type name 'NSString' ... ... Semantic Issue - Use of undeclared identifier 'aSelectorName' ... ... Semantic Issue - Use of undeclared identifier 'aClassName' ...
This has been going on for some time with similar errors ...
From what I read, these errors appear due to dependencies on the Foundation Framework, which I believe are included in the project. I also tried clicking a project in Xcode
Now I want to say where I’m not sure what to do next. People say it's not difficult to use Objective-C in C / C ++ code, but being new to Xcode and Objective-C can contribute to my confusion. This is only the 4th day for me on this new platform.
What do I need to do to get Xcode to compile Objective-C code? Please remember that I'm a little new to this, so I would appreciate it if you would leave detailed answers, rather than the vague single-line that are common in the firebreath message. I’m just a little over my head, but if you can overcome this obstacle for me, I’m sure that I’ll go well from there.
UPDATE:
I edited the /MyPlugin/CMakeLists.txt projects and added them in the .m and .mm rules. after starting prepmac.sh, the files are included in the project, but I still get the same compilation errors.
I moved all the .h and .mm files from the Obj C code to the MyPlugin root folder and rerun the prepmac.sh file. The problem still exists. The same compilation errors.