Skip to content

multiple definition of crow::method_strings #350

@nekoffski

Description

@nekoffski

Hi,

I had just updated the crow submodule for my project and I faced the below linker error:

/usr/bin/ld: CMakeFiles/sparkle-connector.dir/api/BoardController.cpp.o:(.data.rel.local+0x0): multiple definition of `crow::method_strings'; CMakeFiles/sparkle-connector.dir/api/ApiService.cpp.o:(.data.rel.local+0x0): first defined here
/usr/bin/ld: CMakeFiles/sparkle-connector.dir/main.cpp.o:(.data.rel.local+0x0): multiple definition of `crow::method_strings'; CMakeFiles/sparkle-connector.dir/api/ApiService.cpp.o:(.data.rel.local+0x0): first defined here
collect2: error: ld returned 1 exit status

The cause of the issue is based here:

const char* method_strings[] = ...

Including the above header in at least 2 different compilation units that will be linked together ends up generating 2 same symbols for this variable.

I'm a bit confused because GH actions show that all checks on the master branch pass. Did I do something wrong (e.g. crow is not expected to be included in more than a single file, but that would be at least strange) or there is something missing in your test harness?

If it is a bug, I recommend changing method_strings to a static local variable (it seems that it is used only in a single function but I haven't investigated it deeply).

Thanks in advance for the clarification :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions