This is my a.c code :
#include <stdio.h>
#include <socket.h>
int main(void)
{
int count[4] = {[2] = 3 }, i;
for (i = 0; i < 4; i++)
printf("count[%d]=%d\n", i, count[i]);
return 0;
}
When I comp开发者_C百科ile it, it shows:
a.c:2: fatal error: socket.h: No such file or directory
compilation terminated.
So how do I include it / where can download it?
It should be:
#include <sys/socket.h>
Paths are given relatively to the /usr/include path. So e.g. the socket.h file is under /usr/include/sys/socket.h. You can search for it if you don't know:
find /usr/include/ -name SEARCHED_HEADER.h
精彩评论