Vijay Manohar Vijay Manohar - 1 year ago 425
C Question

Timespec :struct type Error c2011

While executing a Pthread program in C using Visual Studio 2015.I got the following error

Error C2011 'timespec': 'struct' type redefinition

The following is my code:


void *calculator(void *parameter);

int main(/*int *argc,char *argv[]*/)
pthread_t thread_obj;
pthread_attr_t thread_attr;
char *First_string = "abc"/*argv[1]*/;

void *calculator(void *parameter)
int x=atoi((char*)parameter);
printf("x=%d", x);

Answer Source

Add this compiler flag, must solve (worked for me with same problem):

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download