4.26 compile error LNK2005

Hello,

I’m having issue during compile with following errors:

1> [1/2] UE4Editor-AO-Win64-DebugGame.dll
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void * __cdecl operator new(unsigned __int64)” (??2@YAPEAX_K@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void * __cdecl operator new(unsigned __int64,struct std::nothrow_t const &)” (??2@YAPEAX_KAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete(void *)” (??3@YAXPEAX@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete(void *,struct std::nothrow_t const &)” (??3@YAXPEAXAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete(void *,unsigned __int64)” (??3@YAXPEAX_K@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete(void *,unsigned __int64,struct std::nothrow_t const &)” (??3@YAXPEAX_KAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void * __cdecl operator new[](unsigned __int64)” (??_U@YAPEAX_K@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void * __cdecl operator new[](unsigned __int64,struct std::nothrow_t const &)” (??_U@YAPEAX_KAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete[](void *)” (??_V@YAXPEAX@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete[](void *,struct std::nothrow_t const &)” (??_V@YAXPEAXAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete[](void *,unsigned __int64)” (??_V@YAXPEAX_K@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “void __cdecl operator delete[](void *,unsigned __int64,struct std::nothrow_t const &)” (??_V@YAXPEAX_KAEBUnothrow_t@std@@@Z) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: InitializeModule already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “unsigned char * * GNameBlocksDebug” (?GNameBlocksDebug@@3PEAPEAEEA) already defined in Module.AO.1_of_3.cpp.obj
1>Module.AO.2_of_3.cpp.obj : error LNK2005: “class FChunkedFixedUObjectArray * & GObjectArrayForDebugVisualizers” (?GObjectArrayForDebugVisualizers@@3AEAPEAVFChunkedFixedUObjectArray@@EA) already defined in Module.AO.1_of_3.cpp.obj
1> Creating library C:\DemonKnightsCV\AO\Intermediate\Build\Win64\UE4Editor\DebugGame\AO\UE4Editor-AO-Win64-DebugGame.suppressed.lib and object C:\DemonKnightsCV\AO\Intermediate\Build\Win64\UE4Editor\DebugGame\AO\UE4Editor-AO-Win64-DebugGame.suppressed.exp
1>C:\DemonKnightsCV\AO\Binaries\Win64\UE4Editor-AO-Win64-DebugGame.dll : fatal error LNK1169: one or more multiply defined symbols found

Pls help

I have found out issue being related to other module defined inside main module.

1 Like

Hey, Spectral Arts, I came across the same issue. Your discovery led me in the right direction.
I have found the problem in my case. In the .cpp I used IMPLEMENT_PRIMARY_GAME_MODULE() Even though I already had one in another module.

Make sure that you only have one PRIMARY and the remaining modules being IMPLEMENT_GAME_MODULE().

Like described here. Hope this helps, even though it is a bit late.

5 Likes

Yea, as @Spectral Arts said, problem is module inside your app classes.
For me it was redundant IMPLEMENT_MODULE define.

Thank you. I created the runtime plugins using the second IMPLEMENT_PRIMARY_GAME_MODULE(). After switching to IMPLEMENT_GAME_MODULE(), I was able to package the project without any errors.