Hi
#include "training.h"
#include <mqueue.h> // for posix mqs
int main(int argc,char *argv[])
{
int opt,flag;
mqd_t msq; // msg q type
flag=O_RDWR|O_CREAT;
while((opt =getopt(argc,argv,"e")) != -1)
{
switch(opt)
{
case 'e':
flag|=O_EXCL;
break;
}
}
// option indicator should be one less than what is passed
if(optind != argc -1)
{
fprintf(stderr,"usag: msqcr -e <name>\n");
return 1;
}
msq =mq_open(argv[optind],flag,0666,NULL);
mq_close(msq);
}
When i tried to compile this code
-bash-3.1$ gcc mqcreate.c
/tmp/cccJjZP4.o: In function `main':
mqcreate.c:(.text+0xc1): undefined reference to `mq_open'
mqcreate.c:(.text+0xcf): undefined reference to `mq_close'
collect2: ld returned 1 exit status
-bash-3.1$
I am having problem in linking i guess.
Please can anyone help me on this
THanks
Kumaran