Multiple definition of 'PIN_MAP' error with Photon

Hello folks,

When compiling a simple program using two libraries that utilize PIN_MAP, I’m getting the error below:

Both libraries have been adapted to work with the Photon, and they run well when used independently.

It seems that the root cause is this declaration STM32_Pin_Info* PIN_MAP = HAL_Pin_Map();

What is the best practice? Should I rename PIN_MAP once per library: PIN_MAP_LIB1, PIN_MAP_LIB2, etc…?


Change the definition to

static STM32_Pin_Info* PIN_MAP = HAL_Pin_Map();

So that it becomes a non-exported symbol.

(I had meant to mention this in the PIN_MAP thread, but got sidetracked by other discussions.)


Thank you @mdma!

That worked well.