I am mocking a function that is linked into the `lib_dot_stack_unit_tests.a`. Somehow I am getting the error of 'multiple definition of' the mocked function.
In file 'dot_requisition_dispatcher_test.cpp', inside a test, I call a production code function that calls 'network_init()' that is inside 'network.c', the 'network_init' function is the one I wrote a mock inside the file network_mocks.cpp.
I have two definitions of submodule_init, the original one inside production_code_lib.a, and the mocked version that is compiled into a .o object.
At the final linking I get the error:
make -f
make_unit_tests.mk all
compiling dot_requisition_dispatcher_test.cpp
compiling network_frame_test.cpp
compiling main.cpp
compiling logging.c
compiling network_mocks.cpp
compiling network_frame.c
compiling dot_requisition_dispatcher.c
compiling network.c
Building archive obj_tests/lib_dot_stack_unit_tests.a
a - obj_tests/./src/network_frame.o
a - obj_tests/./src/dot_requisition_dispatcher.o
a - obj_tests/./src/network.o
Linking dot_stack_unit_tests
obj_tests/lib_dot_stack_unit_tests.a(network.o): In function `network_init':
/home/fanl/workspace-beyond/software/mesh/dot_stack/src/network.c:14: multiple definition of `network_init'
collect2: error: ld returned 1 exit status
make: *** [dot_stack_unit_tests] Error 1