I'm trying to compile a src code of an application that have the libs stripped from the files.
I already downloaded, compiled and linked each lib the project needs but I'm having trouble with a specific one: crypto (https://www.cryptopp.com/).
I receive a LNK2005 (symbol already defined) when trying to compile. The exact error message is:
Error LNK2005 "public: __cdecl CryptoPP::Rijndael::Enc::Enc(void)" (??0Enc@Rijndael@CryptoPP@@QEAA@XZ) already defined in cryptlib_5_65-v141-x64.lib(rijndael.obj) IGC.GameServer D:\MU Online\IGCN_S9E2_Emu\source\GameServer\PacketEncrypt.obj 1
Error LNK1169 one or more multiply defined symbols found IGC.GameServer D:\MU Online\IGCN_S9E2_Emu\source\Output\IGC.GameServer\Release\IGC.GameServer.exe 1
Apparently the linker is complaining that the type public: __cdecl CryptoPP::Rijndael::Enc::Enc(void)
is being defined twice (in rijndael.obj - crypto lib - and in PacketEncrypt.obj - the project I'm trying to compile).
I already had fixed the LNK2005 a lot of times in the past but this time I just can't figure out what's hapening.
As I don't know what can be causing this error I don't know exactly what to share here regarding the code. Bellow is some code I think that can help but if you feel something is missing you can ask for more code.
Declaration of the type being defined twice
If I comment the two lines selected in the second print (and obviously cut off their references in the code) I can compile the project without any problem.
Thanks in advance.
答案 0 :(得分:0)
所以你将cryptlib_5_65链接到IGC.GameServer,但cryptlib已经有了这个功能。我猜rijndael.cpp实际上属于cryptlib项目,但你也将源文件添加到GameServer项目中。检查该文件是否不在两个项目中,如果是,请将其从GameServer中删除 实施应仅在其中一个中 可能不是这种情况,但缺乏更好的信息,使得很难找到解决方案。
我会将其作为评论发布,但不足以支持我。