Language
C
Compiler
gcc HEAD 11.0.0 20201123 (experimental)
Options
Warnings
C11(GNU)
no pedantic
$ gcc prog.c -Wall -Wextra -std=gnu11
prog.c:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include stdio.h
| ^~~~~
prog.c:2:10: error: #include expects "FILENAME" or <FILENAME>
2 | #include stdlib.h
| ^~~~~~
prog.c:3:10: error: #include expects "FILENAME" or <FILENAME>
3 | #include time.h
| ^~~~
prog.c:4:10: error: #include expects "FILENAME" or <FILENAME>
4 | #include systypes.h
| ^~~~~~~~
prog.c:5:10: error: #include expects "FILENAME" or <FILENAME>
5 | #include unistd.h
| ^~~~~~
prog.c:6:10: error: #include expects "FILENAME" or <FILENAME>
6 | #include string.h
| ^~~~~~
prog.c:7:10: error: #include expects "FILENAME" or <FILENAME>
7 | #include fcntl.h
| ^~~~~
prog.c:8:10: error: #include expects "FILENAME" or <FILENAME>
8 | #include sysmman.h
| ^~~~~~~
prog.c:9:10: error: #include expects "FILENAME" or <FILENAME>
9 | #include sysipc.h
| ^~~~~~
prog.c:10:10: error: #include expects "FILENAME" or <FILENAME>
10 | #include syssem.h
| ^~~~~~
prog.c:11:10: error: #include expects "FILENAME" or <FILENAME>
11 | #include semaphore.h
| ^~~~~~~~~
prog.c:12:10: error: #include expects "FILENAME" or <FILENAME>
12 | #include sysshm.h
| ^~~~~~
prog.c:13:10: error: #include expects "FILENAME" or <FILENAME>
13 | #include sysmman.h
| ^~~~~~~
prog.c:14:10: error: #include expects "FILENAME" or <FILENAME>
14 | #include sysstat.h
| ^~~~~~~
prog.c:15:10: error: #include expects "FILENAME" or <FILENAME>
15 | #include fcntl.h
| ^~~~~
prog.c:16:10: error: #include expects "FILENAME" or <FILENAME>
16 | #include errno.h
| ^~~~~
prog.c:17:10: error: #include expects "FILENAME" or <FILENAME>
17 | #include time.h
| ^~~~
prog.c: In function 'main':
prog.c:21:5: error: unknown type name 'sem_t'
21 | sem_t mut;
| ^~~~~
prog.c:24:5: error: unknown type name 'sem_t'
24 | sem_t s;
| ^~~~~
prog.c:25:5: warning: implicit declaration of function 'sem_init' [-Wimplicit-function-declaration]
25 | sem_init(&s, 0, 1);
| ^~~~~~~~
prog.c:27:8: warning: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
27 | if(fork()==-1){
| ^~~~
prog.c:28:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
28 | printf(Brak zasobów do rozwidlenia procesu!n);
| ^~~~~~
prog.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | #include stdio.h
prog.c:28:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
28 | printf(Brak zasobów do rozwidlenia procesu!n);
| ^~~~~~
prog.c:28:9: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:28:16: error: 'Brak' undeclared (first use in this function)
28 | printf(Brak zasobów do rozwidlenia procesu!n);
| ^~~~
prog.c:28:16: note: each undeclared identifier is reported only once for each function it appears in
prog.c:28:20: error: expected ')' before 'zasob\U000000f3w'
28 | printf(Brak zasobów do rozwidlenia procesu!n);
| ~ ^~~~~~~~
| )
prog.c:32:9: warning: implicit declaration of function 'sem_wait' [-Wimplicit-function-declaration]
32 | sem_wait(&s);
| ^~~~~~~~
prog.c:33:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
33 | printf(tatan);
| ^~~~~~
prog.c:33:9: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:33:16: error: 'tatan' undeclared (first use in this function)
33 | printf(tatan);
| ^~~~~
prog.c:36:14: warning: implicit declaration of function 'shm_open' [-Wimplicit-function-declaration]
36 | fd = shm_open(shared_memmory_object,O_RDWR , 0777);
| ^~~~~~~~
prog.c:36:23: error: 'shared_memmory_object' undeclared (first use in this function)
36 | fd = shm_open(shared_memmory_object,O_RDWR , 0777);
| ^~~~~~~~~~~~~~~~~~~~~
prog.c:36:45: error: 'O_RDWR' undeclared (first use in this function)
36 | fd = shm_open(shared_memmory_object,O_RDWR , 0777);
| ^~~~~~
prog.c:38:26: warning: implicit declaration of function 'mmap' [-Wimplicit-function-declaration]
38 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~
prog.c:38:34: error: invalid suffix "sizeof" on integer constant
38 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~~~~~
prog.c:38:43: error: expected expression before 'int'
38 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~
prog.c:38:48: error: 'PROT_READPROT_WRITE' undeclared (first use in this function)
38 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~~~~~~~~~~~~~~~~
prog.c:38:68: error: 'MAP_SHARED' undeclared (first use in this function)
38 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~~~~~~~
prog.c:40:9: error: 'sort' undeclared (first use in this function)
40 | sort
| ^~~~
prog.c:40:13: error: expected ';' before 'for'
40 | sort
| ^
| ;
41 | for(int i =0;i10;i++)
| ~~~
prog.c:60:9: warning: implicit declaration of function 'munmap' [-Wimplicit-function-declaration]
60 | munmap(addr,10sizeof(int));
| ^~~~~~
prog.c:60:21: error: invalid suffix "sizeof" on integer constant
60 | munmap(addr,10sizeof(int));
| ^~~~~~~~
prog.c:60:30: error: expected expression before 'int'
60 | munmap(addr,10sizeof(int));
| ^~~
prog.c:61:9: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration]
61 | close(fd);
| ^~~~~
prog.c:62:9: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
62 | sleep(1);
| ^~~~~
prog.c:65:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
65 | printf(synn);
| ^~~~~~
prog.c:65:13: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:65:20: error: 'synn' undeclared (first use in this function)
65 | printf(synn);
| ^~~~
prog.c:68:55: error: expected ')' before 'O_CREAT'
68 | fd = shm_open(shared_memmory_object,O_RDWR O_CREAT, 0777);
| ~ ^ ~~~~~~~
| )
prog.c:70:13: warning: implicit declaration of function 'ftruncate' [-Wimplicit-function-declaration]
70 | ftruncate(fd,10sizeof(int));
| ^~~~~~~~~
prog.c:70:26: error: invalid suffix "sizeof" on integer constant
70 | ftruncate(fd,10sizeof(int));
| ^~~~~~~~
prog.c:70:35: error: expected expression before 'int'
70 | ftruncate(fd,10sizeof(int));
| ^~~
prog.c:72:38: error: invalid suffix "sizeof" on integer constant
72 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~~~~~
prog.c:72:47: error: expected expression before 'int'
72 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~
prog.c:74:13: warning: implicit declaration of function 'srand' [-Wimplicit-function-declaration]
74 | srand(time(NULL));
| ^~~~~
prog.c:74:19: warning: implicit declaration of function 'time' [-Wimplicit-function-declaration]
74 | srand(time(NULL));
| ^~~~
prog.c:74:24: error: 'NULL' undeclared (first use in this function)
74 | srand(time(NULL));
| ^~~~
prog.c:1:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
+++ |+#include <stddef.h>
1 | #include stdio.h
prog.c:75:30: error: expected ';' before numeric constant
75 | for (int i = 0; i 10; i++) {
| ^ ~~
| ;
prog.c:76:21: error: subscripted value is neither array nor pointer nor vector
76 | addr[i] = rand()%100;
| ^
prog.c:76:27: warning: implicit declaration of function 'rand' [-Wimplicit-function-declaration]
76 | addr[i] = rand()%100;
| ^~~~
prog.c:78:13: error: 'print' undeclared (first use in this function); did you mean 'int'?
78 | print
| ^~~~~
| int
prog.c:78:18: error: expected ';' before 'for'
78 | print
| ^
| ;
79 | for (int i = 0; i 10; i++) {
| ~~~
prog.c:72:17: warning: variable 'addr' set but not used [-Wunused-but-set-variable]
72 | int addr = (int) mmap(0, 10sizeof(int),PROT_READPROT_WRITE,MAP_SHARED,fd,0);
| ^~~~
prog.c:21:11: warning: unused variable 'mut' [-Wunused-variable]
21 | sem_t mut;
| ^~~
prog.c:20:8: warning: unused variable 'tab' [-Wunused-variable]
20 | int tab[5];
| ^~~
Exit Code:
1