problem socket

closed account (28poGNh0)
why my compiler did not recognize this header <sys/socket.h>
and how to result this problem
thanks a lot for reading
Do you use windows? Because <sys/socket.h> is for UNIX/Linux.
closed account (28poGNh0)
yes thanks
tell me how to fix that problem
do I need to download a new library
I found the answer in 10 seconds just by googling it. So a tip is, always google/youtube your problem before posting in forums, so no one times has to be wasted.

The solution is suggested in this thread - http://stackoverflow.com/questions/22432910/makefile-error-sys-socket-h-no-such-file-or-directory-under-windows
OP wrote:
So a tip is, always google/youtube your problem before posting in forums, so no one times has to be wasted.

There is a certain circular dependency there... Never the less, I applaud your new found sense of independence. The only thing I would like to add is that you should define 'WIN32_LEAN_AND_MEAN' before including 'Winsock2.h' (EDIT: Preferably just set this at the top) so that no other Windows headers, such as 'Windows.h', try to bring in 'Winsock.h' which will have conflicting definitions with it's successor.
Last edited on
Just to clarify, I didn't find my sense of independence. The sense of independence found me.
closed account (28poGNh0)
@TarikNeaj : I always google.. before posting anything in this website only to avoid topic duplication so that others(@Duoas for exp..) save valuable time instead of writing the backacked F.A.Qs:)

@Computergeek01 : I read about headers conflits ,cross-platform and some sort of third-party ... I did not got that . in one of stackoverflow's pages I found this lines wich correct the problem after of course resolving the linking problem generated by socket function
1
2
3
4
5
#ifdef __WIN32__
# include <winsock2.h>
#else
# include <sys/socket.h>
#endif 


Edit : problem resolved

finaly thnks both of you hope for more new info
Last edited on
Topic archived. No new replies allowed.