Duplicate symbol linker errors when using C++ types

I'm working on building a SwiftUI application on top of an existing C++ model layer. I'm having an issue where when multiple Swift files refer to the same model objects, I start getting duplicate symbol warnings in the linker.


duplicate symbol '_$sSo3DfpO12MyCPPClassNameVMa' in:

I'm not entirely sure why this is happening - I'm trying to narrow it down to a specific set of conditions I could reproduce. I am doing things like extending my C++ types to conform to Identifiable. But I can't reliably trace these issues directly to the existence of extending C++ types.

Are there any known issues in Xcode 15.0.1 with C++ types creating duplicate symbols?

1 Like