2021年3月13日星期六

Why is the function initialized in the if statement?

For some reason, I'm getting an error that says conflicting types for 'get_property' because the function is reinitialized below. Why is this happening and how can I fix this?

/* find the longest client_machine name */  for (i = 0; i < client_list_size / sizeof(Window); i++)  {      gchar *client_machine;      if ((client_machine = get_property(disp, client_list[i],                                         XA_STRING, "WM_CLIENT_MACHINE", NULL)))      {          max_client_machine_len = strlen(client_machine);      }      g_free(client_machine);  }  

Details of the error:

/home/raphael/Desktop/Projects/sus/util.h:134:8: error: conflicting types for 'get_property'    134 | gchar *get_property(Display *disp, Window win,        |        ^~~~~~~~~~~~  /home/raphael/Desktop/Projects/sus/util.h:64:31: note: previous implicit declaration of 'get_property' was here     64 |         if ((client_machine = get_property(disp, client_list[i],        |                               ^~~~~~~~~~~~  
https://stackoverflow.com/questions/66620619/why-is-the-function-initialized-in-the-if-statement March 14, 2021 at 10:46AM

没有评论:

发表评论