winsock compiling error, it cant find the addrinfo structures and some relating functions

前端 未结 5 758
夕颜
夕颜 2020-12-31 04:58

I\'ve just started learning winsock through the \"Beej\'s guide to network programming\" book. I\'m programming under windows and running it through gcc. This is just a star

5条回答
  •  一向
    一向 (楼主)
    2020-12-31 05:35

    Beware! Your includes are wrong. The problem is that windows.h already includes winsock.h and winsock2.h then re-defines some structures and functions resulting in huge number of compilation errors. Move the windows.h include below the winsock2.h include, or just remove the windows.h include altogether, winsock2.h includes windows.h.

提交回复
热议问题