Skip to content

Link errors when the header is included from multiple modules #5

Description

@cedricleca

The instanciation of the template VgjsCoroPromise for void causes Link errors when the header is included from multiple modules:
1>LINK : H:\Dev\GameTemplate\\x64\Debug\Skull8.exe not found or not built by the last incremental link; performing full link 1>Settings.ixx.obj : error LNK2005: "public: class vgjs::VgjsCoroReturn<void> __cdecl vgjs::VgjsCoroPromise<void>::get_return_object(void)" (?get_return_object@?$VgjsCoroPromise@X@vgjs@@QEAA?AV?$VgjsCoroReturn@X@2@XZ) already defined in main.obj 1>SoundResources.ixx.obj : error LNK2005: "public: class vgjs::VgjsCoroReturn<void> __cdecl vgjs::VgjsCoroPromise<void>::get_return_object(void)" (?get_return_object@?$VgjsCoroPromise@X@vgjs@@QEAA?AV?$VgjsCoroReturn@X@2@XZ) already defined in main.obj 1>H:\Dev\GameTemplate\\x64\Debug\Skull8.exe : fatal error LNK1169: one or more multiply defined symbols found

Commenting the following instanciation solves the linking issue:
auto VgjsCoroPromise<void>::get_return_object() noexcept -> VgjsCoroReturn<void> { return { std::coroutine_handle<VgjsCoroPromise<void>>::from_promise(*this) }; };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions