I have a problem with sub-projects (regular, nested projects) in Xcode4.
My situation is as follows: I have a project named App and a sub-project named Lib. App depends on Lib. I can compile and run App and everything gets compiled and linked as I would expect and works fine.
The problem occurs when I make a change to a file in Lib and try to re-run App. It seems that the changes in the sub-project, Lib is being compiled since if there are compilation errors, they are flagged up. However, the changes are not reflected when App runs. It seems that the changes are not getting correctly linked in.
The project was migrated from Xcode3 where this problem did not occur.
Probably related to this is the following. I use a simple conditional log statement which outputs a log statements only when the project开发者_开发知识库 is compiled in Debug mode. It's a macro and it defines a function called DLog and it is used both in App and in Lib. Things work fine up in App and log statements are duly written out. In Lib however, no statements are displayed.
What is going on? It's as though the linkage between the projects is somehow b0rked. Has anyone else seen this and what's the fix please?
I seem to recall something like, in Xcode 3, the App's build settings cascaded to the Lib/subproject. I'll bet that now the Lib is entirely distinct, almost as if the two were peers in an Xcode 4 workspace. I'd love to tell you/myself/the-world how to cascade those settings, other than using .xcconfig files.
You can probably fix the dependency problem by including the Lib in the App's build scheme (search "Xcode edit scheme"; you want the order to be Lib -> App). If it persists, uncheck "Parallelize Builds" and try again.
Your DLOG macro is probably defined or included in your App's PCH file, and would not (or "no longer") cascade to the Lib's PCH. You can
- put that macro in a .h file in your Lib
- make sure that .h file is public (search "Xcode build phases copy headers public")
#include "your_macro_file.h"
in both PCH files.
That should get your DLOG working in both.
精彩评论