Cross-Compiling - "undefined reference" - Winsock



  • /tmp/ccq5qNqZ.o:main.cpp:(.text+0xa1e): undefined reference to `_WSAStartup@8'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0xa5f): undefined reference to `_WSACleanup@0'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x298e): undefined reference to `_closesocket@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x2ae4): undefined reference to `_closesocket@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x2ef1): undefined reference to `_inet_addr@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x2f2b): undefined reference to `_gethostbyname@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x2f82): undefined reference to `_htons@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x2fb0): undefined reference to `_socket@12'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x302a): undefined reference to `_connect@12'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x306e): undefined reference to `_closesocket@4'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x332d): undefined reference to `_send@16'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x3672): undefined reference to `_recv@16'
    /tmp/ccq5qNqZ.o:main.cpp:(.text+0x3ba0): undefined reference to `_recv@16'
    collect2: ld returned 1 exit status
    

    Auf Wunsch eines Bekannten versuche ich derzeit zwei selbstgeschriebene Tools von Linux auf Windows zu portieren. Nachdem nun alle Compilerfehler des Cross-Compilers "i586-mingw32msvc-c++" ausgemerzt sind, erscheint obige - für mich ominöse - Fehlermeldung.
    Wenn man von den Funktionsnamen ausgehen kann, scheint etwas mit der "winsock.h" , respektive allgemein der Netzwerkprogrammierung mit den Winsocks nicht zu stimmen, was auch der Grund ist, dass ich den Thread hier im WinAPI Unterforum erstelle. Wenn es hier unpassend ist, möge man den Thread doch bitte verschieben. 🙂

    Kennt jemand unter euch vielleicht eine Lösung für mein Problem?



  • Ich hab's nun doch selbst gefunden:
    Ich Depp hab vergessen die Winsock-Lib mitzulinken:

    ... -lwsock32 ...
    

    mfg Mark


Anmelden zum Antworten