Reputation: 339
I Have an iOS application that I am trying to add OCMock to in order to better unit test it. I've followed the instruction on ocmock.org as well as instructions I've found in other places but still I cannot get my test code to compile.
Here's what I've done
Added the source code to my project directory
Create the groups in my project to mimic my file system
I selected the option to add to my test targets so the framework was added appropriately as well as the Library Search Path
Then I manually added the headers to the Header Search Path
And added the -ObjC linker flag
Then when I go to import the header file, I get the file not found error
Any ideas what I am missing here???
Upvotes: 8
Views: 5867
Reputation: 613
One more thing to check, for anyone else having this problem - I copied OCMock from one project to another and everything looked right, but it wasn't finding the include file. It turned out that even though I had the right groups in Xcode, the files had all been dumped into one directory. I needed to create folders on disk and associate them with the groups in Xcode. The accepted answer here clued me in to what was wrong (though as is often the case, in hindsight it should have been obvious).
Upvotes: 0
Reputation: 42588
You have the search path test/libraries/OCMock
. Then you have #import <OCMock/OCMock.h>
.
This fails because there is no file test/libraries/OCMock/OCMock/OCMock.h
.
You use the search path test/libraries
, or you can create a prefix directory to hold OCMock
and have the search path point at that.
I generally have a directory with the library name and version number before the actually directory.
The directory test/libraries/OCMock-X.X.X
could contain the OCMock
directory. That way the search path still be more specific: test/libraries/OCMock-X.X.X
and you still use OCMock/OCMock.h
as the include.
Upvotes: 18