Undefined reference with multiple services

I’m using MBedOS 5.12

I have a project with two services defined in respective .json files of the form

{
  "name": "MY_SRV",
  "type": "APPLICATION-ROT",
  "priority": "LOW",
  "id": "0x00000180",
  "entry_point": "my_task",
  "stack_size": "0x2000",
  "heap_size": "0x2000",
  "services": [
    {
      "name": "MY_SERVICE_ID",
      "identifier": "0x00000181",
      "signal": "GET_STATE",
      "non_secure_clients": true,
      "minor_version": 1,
      "minor_policy": "STRICT"
    }
  ],
  "extern_sids": [
    "MY_EVENT_ID"
  ],
  "source_files": [
    "path/to/my_task.cpp"
  ]
}

I’ve been successfully building for some time. As part of my development, I added a library to a subdirectory of my project. Simply adding a #include sufficed to successfully link in the new library to one of my services. I’m now trying to link it into my other service but I’m getting a link-time error, namely “undefined reference”.

NOTE: I have another library that is being linked into both services without issue so I expected this to also work without issue.

As a check, I found my_task.d and it listed the include files that I would expect to trigger appropriate linking.

Does anyone know what may be causing this to fail to link?

Darn it – cpp name mangling – the new file is a .cpp file. :frowning: Therefore, some appropriately placed

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

did the trick.