Hi. The function msgget from sys/msg.h is not being recognized by Netbeans 7.2.1. Have I missed anything?
OS: OpenSUSE 12.2 "Mantis"

#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>


extern void exit();
extern void perror();

int main(void) {

    key_t key;
    int msgflg, msqid;
    fprintf(stdout, "All numeric input is expected to follow C conventions:\n");
    fprintf(stdout, "\t0... is interpreted as hexadecimal,\n");
    fprintf(stdout, "\totherwise, decimal.\n");
    fprintf(stdout, "IPC_PRIVATE == %#x\n", IPC_PRIVATE);

    fprintf(stdout, "Enter key: ");
    scanf("%d", &key);


    fprintf(stdout, "\nExpected flags for msgflg argument are:\n");
    (void) fprintf(stdout, "\tIPC_EXCL =\t%#8.8o\n", IPC_EXCL);
    (void) fprintf(stdout, "\tIPC_CREAT =\t%#8.8o\n", IPC_CREAT);
    (void) fprintf(stdout, "\towner read =\t%#8.8o\n", 0400);
    (void) fprintf(stdout, "\towner write =\t%#8.8o\n", 0200);
    (void) fprintf(stdout, "\tgroup read =\t%#8.8o\n", 040);
    (void) fprintf(stdout, "\tgroup write =\t%#8.8o\n", 020);
    (void) fprintf(stdout, "\tother read =\t%#8.8o\n", 04);
    (void) fprintf(stdout, "\tother write =\t%#8.8o\n", 02);

    (void) fprintf(stdout, "Enter msgflg value: ");
    scanf("%d", &msgflg);

    fprintf(stdout, "\nmsgget: Calling msgget(%#x, %#o)\n", key, msgflg);

    if((msqid = msgget(key, msgflg)) == -1)
    {
       perror("msgget");
       exit(1);
    }    
    else {
      fprintf(stdout, "Msgget succeeded. msqid = %d\n", msqid);   
    }
    exit(1);
}

what is the exact error message, maybe you misunderstood it?

Do you mean it won't compile, or it won't link, or the IDE doesn't give you a nice tooltip?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.