I have got the solution for your problem. when you type cat /usr/include/sys/msg.h you can see that the struct is commented out when __USE_GNU is not defined. /usr/include/sys/msg.h:
#ifdef __USE_GNU
/* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */
struct msgbuf
{
long int mtype; /* type of received/sent message */
char mtext[1]; /* text of the message */
};
#endif
A bit of Googeling brings the result that you should #define _GNU_SOURCE
to use that struct. It is important to define it before you #include <sys/msg.h>
. I hope i helped. greetings 0xeffe TLDR solution:
#define _GNU_SOURCE
#include <sys/msg.h>