Code compiles on OpenBSD but not on Linux
I have some code that compiles fine on OpenBSD, but it recieves a parse error when I attempt to compile it in Linux.
I am using gcc 2.95.3 on both computers. I am attemping to turn the .c file into an object file with the command:
Code:
cc -DDEBUG -DVERSION=\"0.1beta\" -I./ -g -O3 -Wall -W -pedantic -ansi
-Wtraditional -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast
-Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -c -o messagequeue.o
messagequeue.c
I am getting the errors:
Code:
messagequeue.c: In function `messageQueueInit':
messagequeue.c:20: parse error before `{'
messagequeue.c:21: parse error before `{'
Here is the function:
Code:
MessageQueue *messageQueueInit ()
{
MessageQueue *msgqueue = malloc (sizeof (MessageQueue));
if (msgqueue == NULL)
{
/*
Error here
*/
return NULL;
}
msgqueue->msgcond = PTHREAD_COND_INITIALIZER;
msgqueue->msgmutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_init (&msgqueue->msgcond, NULL);
pthread_mutex_init (&msgqueue->msgmutex, NULL);
msgqueue->queue = queueInit ();
return msgqueue;
}
The oddest part is, lines 20 and 21 are the msgqueue->msgcond = ... lines.
This code compiles with no trouble in OpenBSD, as of right now I am stumped.
I obviously didn't put all the code on here since it is rather long, but if anyone wants to see the rest I can put it online.
Thanks for any tips you can give me.