I'm trying to port a working OSX app (“OriginalApp”) from a GUI interface to a command-line interface, using the same objective-C source code within the same Xcode project, so I can build it either way, while maintaining only one copy of each shared source code file.
Here is what I've done so far:
- within the Project in Xcode (7.1), File->New->Target, select Command Line Tool, [Next], enter new command-line name for target (cli_app) This creates a new folder called "cli_app", at the same level as “OriginalApp"
- rename the generated main.m to main.mm (will use some C++ functionality)
- add a couple new objective-C classes to adapt the CLI interface to the existing code (these are added in the new cli_app folder)
- edit contents of main.mm to use new adapter classes
- add existing files from “OriginalApp” (right-click on new target's folder in Project Navigator pane, click "add files to ‘OriginalApp' " - new subfolder “OriginalApp” appears in Project Navigator under cli_app.
I am hitting a brick wall here. Whatever I do, I'm getting compiler errors: the compiler is not recognizing some of built-in classes when called by the original source code from the new cli_app target.
Errors include
- "Unknown type name 'NSBitmapImageRep' "
- "Use of undeclared identifier 'NSBitmapImageRep' "
The original app still builds fine. I have tried setting the include paths on the new target to match the old one (no help), and making sure the Build phases match (especially the link with binary libraries, but this is not a linker error, so I don't think that's the issue.)
I figure this is a Build settings issue on the new cli_app target, and probably something simple. Any ideas?