VSCode reports an incomplete type is not allowed
error when trying to use struct ip
.
I know this is a problem with intellisense as my program compiles just fine using gcc monitor.c -o monitor -lnet
so there isn't an actual error, but intellisense seems to disagree.
Here is the minimal code to get the error:
#include <netinet/ip.h>
#include <stdlib.h>
int main()
{
struct ip * my_ip = (struct ip *) malloc(sizeof(struct ip));
}
I tried adding /usr/include/**
to the c_cpp_propertied.json
file.
Taking a look into the ip.h
file directly I can see that the struct definition is "hidden" inside an #ifdef __USE_MISC
so I added that to the defines section of c_cpp_propertied.json
with no luck.
I'm fresh out of ideas and I haven't been able to find anything related to the issue. Nothing helpful anyway.