Domanda

I am running cppUnit in OSX production code is compiled into library, and test/mocks are compiled into objets. When I try to mock an external function that is not in the production code, everything works fine. When I try to mock function Bar() in foo.c with a Bar() in foo_mocks.c I get Linking MyProductTests_tests duplicate symbol _Bar in: objs/test/mocks/foo_mocks.o lib/libMyProductTests.a(foo.o) ld: 1 duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I confirmed that foo_mocks.h has

include "foo.h"

I cannot find any guidance on where to look next.

È stato utile?

Soluzione

Function Pointer substitution is required in this case.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top