I'm trying to learn network programming in C, I have this code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#define PORT 8080
#define BUFFLEN 1024
int main() {
int sockfd, clientfd;
char buffer[BUFFLEN];
struct addrinfo hints, *res;
return 0;
}
I use VS code as my main IDE, but as smart as it usually is, it just doesn't seem to work in this case, although I'm probably just doing something wrong.
The above code gives me this error "incomplete type is not allowed"
I cannot access the 'hints' structure, the code completion doesn't work and I have no idea why... I have included all the needed header files, or at least I think so.
Has anybody experienced the same problem? Is there anything I can do to fix it?
I have tried googling for a solution but haven't found anything of use...