irrNet Link errors?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

irrNet Link errors?

Post by aburt11 »

Hey there,

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)
 
and here is the source

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);
 
    }
}
 
thanks in advance
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: irrNet Link errors?

Post by zerochen »

hi,

you have to include

ws2_32.lib

regards
zerochen
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

Re: irrNet Link errors?

Post by aburt11 »

that worked, but now i get these :(

Code: Select all

Error   6   error LNK2019: 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) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
Error   7   error LNK2019: 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) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z)   C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\irrNetLite.lib(CNetManager.obj)
 
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

Re: irrNet Link errors?

Post by aburt11 »

i still have no idea :(

someone come save me :D
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: irrNet Link errors?

Post by zerochen »

sry no idea dude:(

one thing you can check
have you the same settings in your proj and in irrnetlite at
project settings -> c/c++ -> code generation -> runtime lib?

are same libraries ignored?

regards
zerochen
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

Re: irrNet Link errors?

Post by aburt11 »

no worries, ive set myself on using the ice networking library
Post Reply