Kurze build Frage (mingw) zu winsock



  • Schönen guten Abend, wenn ich mein C/C++ Programm mit folgendem makefile compilieren möchte:

    LIBS=-L"C:\MinGW\lib" -llibwsock32 -llibws2_32
    
    all: main
    
    main: main.o
    	g++ main.o -o main.exe $(LIBS)
    
    main.o: main.cpp main.h
    	g++ -c main.cpp
    

    erhalte ich folgende Fehler:
    main.o:main.cpp:(.text+0x145): undefined reference to socket@12' main.o:main.cpp:(.text+0x162): undefined reference tohtons@4'
    main.o:main.cpp:(.text+0x192): undefined reference to bind@12' main.o:main.cpp:(.text+0x1c1): undefined reference toWSAStartup@8'

    Ich binde für eure Hilfe dankbar 😉
    Guten Nacht.



  • Falsches Forum!



  • Ich bin mal nicht so...

    essteeu schrieb:

    LIBS=-L"C:\MinGW\lib" -llibwsock32 -llibws2_32

    Obwohl ich 0 Plan von mingw habe, sollte es glaub ich:

    LIBS=-L"C:\MinGW\lib" -lwsock32 -lws2_32
    

    heißen...


Anmelden zum Antworten