Accumulator
Accumulator

Reputation: 903

Can't use RakNet... linking errors

(note: I'm using Visual Studio 2013)

I'm trying to use RakNet in my project, but I'm running into a lot of problems.

If I try to compile without a lib file:

Error   2   error LNK2019: unresolved external symbol
"public: __thiscall RakNet::SystemAddress::SystemAddress(void)"
(??0SystemAddress@RakNet@@QAE@XZ) referenced in function
"void __cdecl RakNet::`dynamic initializer for 'UNASSIGNED_SYSTEM_ADDRESS''(void)"
(??__EUNASSIGNED_SYSTEM_ADDRESS@RakNet@@YAXXZ)  E:\Fazbear Entertainment\FEplusplus\server\server.obj   _server

If I try to compile with a RakNet static lib file compiled in VS2013 by me:

Error   5   error LNK2019: unresolved external symbol "public: static void __cdecl
RakNet::RakNetSocket2::DomainNameToIP(char const *,char * const)"
(?DomainNameToIP@RakNetSocket2@RakNet@@SAXPBDQAD@Z) referenced in function
"public: bool __thiscall RakNet::SystemAddress::SetBinaryAddress(char const *,char)"
(?SetBinaryAddress@SystemAddress@RakNet@@QAE_NPBDD@Z)   E:\Fazbear Entertainment\FEplusplus\server\RakNetLibStatic.lib(RakNetTypes.obj) _server

Error   2   error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in server.obj   E:\Fazbear Entertainment\FEplusplus\server\RakNetLibStatic.lib(RakNetTypes.obj) _server


Error   3   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in server.obj    E:\Fazbear Entertainment\FEplusplus\server\RakNetLibStatic.lib(RakNetTypes.obj) _server

I only get these errors if I #include "RakPeerInterface.h".

Maybe it would help if I could find a precompiled lib somewhere?

Upvotes: 0

Views: 1042

Answers (1)

Accumulator
Accumulator

Reputation: 903

I had to add the RakNet source files to the project. I heard this before when Googling but didn't fully get what it meant... but it works now. (create a folder/filter in the VC++ project and add the raknet files in the source folder so they compile with your program)

Upvotes: 0

Related Questions