Skip to content

Linking errors of Nodepp while using it in multiple .cpp files in my project #27

@lsergiy

Description

@lsergiy

Hello dear people of Nodepp project!
Including basic headers of Nodepp in two or more *.cpp files of my project produces linking errors:

duplicate symbol 'SHOULD_CLOSE()' in:
    ... ... ...
duplicate symbol 'nodepp::process::onSIGCLOSE' in:
    ... ... ...
duplicate symbol 'nodepp::process::onSIGEXIT' in:
    ... ... ...
duplicate symbol 'nodepp::process::NODEPP_EVLOOP()' in:
    ... ... ...
duplicate symbol 'nodepp::process::NODEPP_INVOKE()' in:
    ... ... ...
duplicate symbol 'nodepp::process::onSIGERROR' in:
    ... ... ...

Here are my Nodepp Includes.

    #include <nodepp/nodepp.h>
    #include <nodepp/date.h>
    #include <nodepp/http.h>
    #include <nodepp/ws.h>

Functions meant in liker output containing errors are completely defined in header files of Nodepp. They are not static and not inline. This is why multiple instance of these functions appear in my project.
I don't see any tricky workaround here. I suspect some modification in Nodepp needed to make usage of it in multiple files possible.
You may move these functions bodies into .cpp file but Nodepp will stop being header only library.
You may move these functions into special implementation .h file and ask Nodepp users to include it only once somewhere in their projects.
Anyway I trust your taste and choice on fixing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions