简体   繁体   中英

Xcode, sharing h / m files between projects?

I'm trying to use the same files in different projects. I'd like to do this so that I can abstract some testing functionality away from my main project.

However, when I add files from my main project, #include calls in those files are using the files in the main project.

eg I have different constant.h files in both projects.

I really don't want to create a library / framework. And I also don't want to have to make changes to the the files specific for one project.

How can I workaround this?

Sharing same physical files in multiple project is not a good idea. Deleting or modifying from one project might break build for other projects. Moreover you must add all dependent functionalities and source in both projects to build successfully. Thats how project build works.

Suggestion

  1. Always keep separate physical copy for separate projects

  2. Even if you want to reuse physical files, make sure all dependencies are added. For example if file A uses file B, to add file A in a project, you must also add file B in the same project even though B has of no use for that project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM