When I am compiling test.c

When I am compiling test.c

Post by srinivasa undrakond » Fri, 20 Jul 2001 07:30:16



Hi,

I have a problem when I am compiling my test.c program on Linux,it's
giving error as shown below.

usr/lib/gcc-lib/i586-mandarke-linux/2.95.2/include/stddef.h:170:parse
error before 'typedef'

sri

here is my test.c source code

/*
 * ~/test.c
 * Copyright (C) 2001 *
 * test the program evnt.c
 * test two conditions, 1. several processes are waiting for
 * event1, and other process send out event1 signal. 2. no
 * process is waiting for event2, and other process send out
 * event2 signal.
 *
 */
#include <sys/types.h>
#include <linux/unistd.h>

/* following establish the system call stab */
_syscall1(int, evntopen, int, evntnum);
_syscall1(int, evntclose, int, evntnum);
_syscall1(int, evntwait, int, evntnum);
_syscall1(int, evntsig, int, evntnum);

int main( void )
{
        pid_t pid; /* used to generate child process */
        int event1, event2; /* use two events to test */

        event1 = evntopen(0); /* create new event */
        event2 = evntopen(0); /* create new event */

        if((pid=fork())==0) /* Parent Process */
        {
                fork();
                fork(); /* fork several process to wait for event 1; */
                printf("Wait Process for event 1 is waiting\n");
                evntwait(event1); /* Process waiting for event 1 */
                printf("Wait Process for event 1 is awaken\n");
        }
        else
        {
                printf("Press any key to send out the event 1\n");
                getchar();
                evntsig(event1); /* process send out event 1 wake up */
                printf("Press any key to send out the event 2\n");
                getchar();
                evntsig(event2); /* process send out event 1 wake up */
                evntclose(event1); /* close event 1 */
                evntclose(event2); /* close event 2 */
        }
        exit(0); /* all processes exit */

Quote:}

--
Posted via CNET Help.com
http://www.help.com/
 
 
 

When I am compiling test.c

Post by r0gu » Fri, 20 Jul 2001 14:44:32



> Hi,

> I have a problem when I am compiling my test.c program on Linux,it's
> giving error as shown below.

> usr/lib/gcc-lib/i586-mandarke-linux/2.95.2/include/stddef.h:170:parse
> error before 'typedef'

The error reported is not in your code, but in the stddef.h file at line
170,(probably a line or two before that is the syntax error).  Take a
look there.

 
 
 

When I am compiling test.c

Post by Nix » Fri, 20 Jul 2001 16:31:02


On Wed, 18 Jul 2001, srinivasa undrakonda stated:

Quote:> #include <sys/types.h>

Kernel-side code must not include <sys/types.h>; this works in userspace
only.

Quote:> #include <linux/unistd.h>

Userspace code should (indeed, essentially *must*) include <unistd.h>,
not <linux/unistd.h>; the latter is for kernel-side code (like kernel
modules).

--
`> You never need to use # for anything, either?
 Not to date, but &#35; would suffice if I did.'
                    -- Stig Brautaset espouses uniquely effective ways
                       of protecting HTML from #-stripping preprocessors