This error has made me very frustrated. The error in full is:
1 2 3 4 5
1
1> main.cpp
1>Server.obj : error LNK2005: "class sf::Packet & __cdecl operator<<(class sf::Packet &,struct NetworkMessage const &)" (??6@YAAAVPacket@sf@@AAV01@ABUNetworkMessage@@@Z) already defined in main.obj
1>Server.obj : error LNK2005: "class sf::Packet & __cdecl operator>>(class sf::Packet &,struct NetworkMessage &)" (??5@YAAAVPacket@sf@@AAV01@AAUNetworkMessage@@@Z) already defined in main.obj
1>C:\Users\David\Documents\Visual Studio 2010\Projects\Kirby_Server\Debug\Kirby_Server.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It says that some functions i made have already been defined in main.obj, but they are not. They are defined in "NetworkMessage.h". I did some researching and found that a common inducement of this error is including a .cpp when a .h was intended. I have already made sure that all of my includes are .h. All of my files begin with #pragma once . If there is anything i should show you to help you help me just let me know. Here is code i think is relevant:
networkmessage.h appears to be included in both main.cpp and server.cpp.
Now if networkmessage.h werte a pure header file containing only declarations, that wouldn't be a problem.