OCMVerify and Undefined symbols for i386 / armv7 / armv7s architecture

I am using OCMock (version 3.1.1) in my project and I am trying to use the OCMVerify macro to check if any method is called inside my object.

The problem is when I put this line:

OCMVerify([mockEngine notify]);

      

Xcode will show me the following link error (I've tried all platforms yet):

Undefined symbols for architecture i386:
  "OCMMakeLocation(objc_object*, char const*, int)", referenced from:
      -[T009_EngineTest testPostEvent] in T009_EngineTest.o
ld: symbol(s) not found for architecture i386

      

I took the latest version of the library from the website and I also tried to compile it myself.

Here is the unit test code:

Engine *mockEngine = OCMClassMock([Engine class]);
Object *obj = [[Object alloc] init];

[mockEngine startUp];
[mockEngine run];
[mockEngine postEvent:obj];

[NSThread sleepForTimeInterval:0.5];

OCMVerify([mockEngine notify]);   // << THIS LINE CREATES THE LINK PROBLEM..

[mockEngine shutDown];

      

If I comment out this line, the compiler communicates successfully. This symbol seems to be missing from the library binary, but I checked it in the Xcode compilation sources list. Then I did a workaround ... I hardcoded this line (source from OCMock) in the unit test file:

OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line){
    return [OCMLocation locationWithTestCase:testCase file:[NSString     stringWithUTF8String:fileCString] line:line];
}

      

And it works! Now I want to know if there is some bug in OCMock or if I am doing something wrong!

Here is the original header file that declares the external OCMakeLocation function: https://github.com/erikdoe/ocmock/blob/master/Source/OCMock/OCMLocation.h and here's its implementation: https://github.com/erikdoe/ocmock/ blob / master / Source / OCMock / OCMLocation.m

Thank.

+3


source to share





All Articles