I was going to use irrnet for my networking in my game engine, i just love this irr* based tech, but ive come across a few linking problems
have i not installed irrnet properly into my project, ive included the header and linked the library.
Code: Select all
Error 1 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)" (__imp_??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(SPacket.obj)
Error 2 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
Error 3 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
Error 4 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
Error 5 error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
Error 6 error LNK2001: unresolved external symbol __imp__htonl@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(host.obj)
Error 7 error LNK2001: unresolved external symbol __imp__htonl@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(peer.obj)
Error 8 error LNK2001: unresolved external symbol __imp__htonl@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(protocol.obj)
Error 9 error LNK2001: unresolved external symbol __imp__htons@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(host.obj)
Error 10 error LNK2001: unresolved external symbol __imp__htons@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(protocol.obj)
Error 11 error LNK2001: unresolved external symbol __imp__htons@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 12 error LNK2001: unresolved external symbol __imp__ntohl@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(peer.obj)
Error 13 error LNK2001: unresolved external symbol __imp__ntohl@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(protocol.obj)
Error 14 error LNK2001: unresolved external symbol __imp__ntohs@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(protocol.obj)
Error 15 error LNK2001: unresolved external symbol __imp__ntohs@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 16 error LNK2001: unresolved external symbol __imp__WSACleanup@0 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 17 error LNK2001: unresolved external symbol __imp__WSAStartup@8 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 18 error LNK2001: unresolved external symbol __imp__gethostbyname@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 19 error LNK2001: unresolved external symbol __imp__gethostbyaddr@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 20 error LNK2001: unresolved external symbol __imp__closesocket@4 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 21 error LNK2001: unresolved external symbol __imp__listen@8 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 22 error LNK2001: unresolved external symbol __imp__bind@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 23 error LNK2001: unresolved external symbol __imp__setsockopt@20 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 24 error LNK2001: unresolved external symbol __imp__ioctlsocket@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 25 error LNK2001: unresolved external symbol __imp__socket@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 26 error LNK2001: unresolved external symbol __imp__connect@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 27 error LNK2001: unresolved external symbol __imp__accept@12 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 28 error LNK2001: unresolved external symbol __imp__WSAGetLastError@0 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 29 error LNK2001: unresolved external symbol __imp__WSASendTo@36 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 30 error LNK2001: unresolved external symbol __imp__WSARecvFrom@36 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 31 error LNK2001: unresolved external symbol ___WSAFDIsSet@8 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Error 32 error LNK2001: unresolved external symbol __imp__select@20 C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(win32.obj)
Code: Select all
#include "main.h"
#include <irrNet.h>
int ping = 100; //miliseconds will be calulated later
core::vector3df playerPosition;
core::vector3df playerAnimation; //no idea how to implement this yet
irr::c8* packetPassword = "affinityNet";
class MyNetCallback : public net::INetCallback
{
virtual void handlePacket(net::SInPacket& packet)
{
packet.decryptPacket(packetPassword); //password for packet
packet.deCompressPacket();
//extract info form a packet via string
core::stringc str;
packet >> str;
//3d vector packet
core::vector3df vec;
packet >> vec;
// Here we are obtaining the last value from the packet. f32 is just a
// typedef for float.
f32 height;
packet >> height;
// Print the values to the console.
std::cout << "Message: " << str.c_str();
std::cout << " Position: " << vec.X << " " << vec.Y << " " << vec.Z;
std::cout << " Height: " << height << " ft";
std::cout << std::endl;
}
};
MyNetCallback* netCallback;
net::INetManager* netManager;
void redNovember::initNetwork()
{
netCallback = new MyNetCallback();
netManager->setVerbose(true); //for debug
}
void redNovember::connectToServer(irr::c8* ipAddress,char* networkName,char* password)
{
netManager = net::createIrrNetClient(0, ipAddress);//where for network to connect
}
void redNovember::shutdownNetwork()
{
delete netManager;
}
void redNovember::networkLoop()
{
while(netManager->getConnectionStatus()!= net::EICS_FAILED)
{
netManager->update(ping);
//send packet crate object
net::SOutPacket packet;
//sedning strings
packet << "some kind of fuckin message\n";
//send co-ordinates
packet << playerPosition << playerAnimation;
//compress packet
packet.compressPacket();
packet.encryptPacket(packetPassword);
netManager->sendOutPacket(packet);
}
}