I am using following makefile below:
CC=g++
all: socket.exe
socket.exe: socket.o
g++ socket.o -o socket.exe
socket.o: socket.cpp
g++ -c socket.cpp
When I run make it show error:
socket.cpp: sys/socket.h: no such file or directory.
How to fix it? I am working on Windows.
<sys/socket.h>
is for UNIX/Linux.
For windows, you use <Winsock2.h>
. You'll also need to link against Ws2_32.lib
and call WSAStartup
to use WinSock.
See also:
socket
function (MSDN)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With