[SOLVED] Unresolved external symbols



  • Hello... I am trying to compile project that I found on the internet, but getting two unresolved external symbols... Project I am trying to compile was built with Qt4 and I am using Qt5...

    I believe errors are appearing because of PacketReceive in header...
    @public:

    //Constructor
    phHandShake();

    //Destructor
    ~phHandShake();

    //HandShake packets
    int PacketReceive(void* data);
    int PacketReceive(void* data, LPBYTE outdata, DWORD* outDataSize);
    int PacketReceive(void* data, SOCKET s);
    @

    Errors:
    phHandShake.obj:-1: error: LNK2019: unresolved external symbol _send@16 referenced in function "public: int __thiscall phHandShake::PacketReceive(void *,unsigned int)" (?PacketReceive@phHandShake@@QAEHPAXI@Z)

    phHandShake.obj:-1: error: LNK2019: unresolved external symbol __imp__CoCreateGuid@4 referenced in function "public: int __thiscall phHandShake::PacketReceive(void *)" (?PacketReceive@phHandShake@@QAEHPAX@Z)


  • Lifetime Qt Champion

    Hi,

    It's rather that one or more of these functions are calling windows specific API(s) and you don't link to the corresponding library. In this case Ole32.lib



  • Hi.
    I think Sometimes this this error occurs when there is different between signature & definition or you use the functions of class wrongly(bad parameter and so on)

    Hope to solve.
    Ya Ali.



  • Have you defined all the member functions of the class that you have declared? This problem encounters when you don't define the functions in .cpp class.

    Hope it helps.



  • Hello... I added lib to .pro file, ran qmake, clean project, rebuild project...

    LIBS += -L"C:/Users/Admin/Desktop/" -lOle32

    Second error has gone, but the first one is still there...

    phHandShake.obj:-1: error: LNK2019: unresolved external symbol _send@16 referenced in function "public: int __thiscall phHandShake::PacketReceive(void *,unsigned int)" (?PacketReceive@phHandShake@@QAEHPAXI@Z)



  • Solved... Had to add one more lib - ws2_32.lib


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.