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
ios ocmock


source to share


No one has answered this question yet

See similar questions:

4
OCMock 3.0.2 linker error with test file .mm

or similar:

273
Undefined symbols for armv7 architecture
232
Undefined symbols for i386 architecture: _OBJC_CLASS _ $ _ SKPSMTPMessage "referenced: error
179
Undefined symbols for arm64 architecture
2
Xcode: Unspecified Symbols for i386 Architecture: DebugStringToFile when creating Unity Project for iOS Simulator
1
Incompatible architectures when linking to static library on iOS Simulator using Qt
1
Undefined symbols for x86_64 architecture when built for ARM64
1
In Xcode 6.1, in unit tests using OCMock, an instance to create a partial mock from is prematurely released
0
Testing a module in xcode (using GHUnit and OCMock)
0
Undefined symbols for x86_64 architecture with OpenSSL library
0
Undefined symbols for armv7 architecture: "_OBJC_CLASS _ $ _ SSZipArchive"



All Articles
Loading...
X
Show
Funny
Dev
Pics