Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Multiple errors on compile #1

Open
LeamHall opened this issue Aug 10, 2024 · 0 comments
Open

Multiple errors on compile #1

LeamHall opened this issue Aug 10, 2024 · 0 comments

Comments

@LeamHall
Copy link
Member

And the Makefile is challenged.

 cc tnc.c -o tnc $CFLAGS -DSYSV -lm
tnc.c:1:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
    1 | ainclude <stdio.h>
      |          ^
In file included from tnc.c:2:
/usr/include/string.h:44:22: error: unknown type name ‘size_t’
   44 |                      size_t __n) __THROW __nonnull ((1, 2));
      |                      ^~~~~~
/usr/include/string.h:34:1: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
   33 | #include <stddef.h>
  +++ |+#include <stddef.h>
   34 | 
/usr/include/string.h:47:56: error: unknown type name ‘size_t’
   47 | extern void *memmove (void *__dest, const void *__src, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:47:56: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:55:32: error: unknown type name ‘size_t’
   55 |                       int __c, size_t __n)
      |                                ^~~~~~
/usr/include/string.h:55:32: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:61:42: error: unknown type name ‘size_t’
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                                          ^~~~~~
/usr/include/string.h:61:42: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:64:56: error: unknown type name ‘size_t’
   64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                        ^~~~~~
/usr/include/string.h:64:56: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:80:60: error: unknown type name ‘size_t’
   80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n)
      |                                                            ^~~~~~
/usr/include/string.h:80:60: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:107:48: error: unknown type name ‘size_t’
  107 | extern void *memchr (const void *__s, int __c, size_t __n)
      |                                                ^~~~~~
/usr/include/string.h:107:48: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:145:53: error: unknown type name ‘size_t’
  145 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:145:53: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:153:23: error: unknown type name ‘size_t’
  153 |                       size_t __n) __THROW __nonnull ((1, 2));
      |                       ^~~~~~
/usr/include/string.h:153:23: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:159:57: error: unknown type name ‘size_t’
  159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
      |                                                         ^~~~~~
/usr/include/string.h:159:57: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:166:8: error: unknown type name ‘size_t’
  166 | extern size_t strxfrm (char *__restrict __dest,
      |        ^~~~~~
/usr/include/string.h:167:54: error: unknown type name ‘size_t’
  167 |                        const char *__restrict __src, size_t __n)
      |                                                      ^~~~~~
/usr/include/string.h:167:54: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:179:8: error: unknown type name ‘size_t’
  179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
      |        ^~~~~~
/usr/include/string.h:179:59: error: unknown type name ‘size_t’
  179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
      |                                                           ^~~~~~
/usr/include/string.h:179:59: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:195:45: error: unknown type name ‘size_t’
  195 | extern char *strndup (const char *__string, size_t __n)
      |                                             ^~~~~~
/usr/include/string.h:195:45: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:293:8: error: unknown type name ‘size_t’
  293 | extern size_t strcspn (const char *__s, const char *__reject)
      |        ^~~~~~
/usr/include/string.h:297:8: error: unknown type name ‘size_t’
  297 | extern size_t strspn (const char *__s, const char *__accept)
      |        ^~~~~~
/usr/include/string.h:407:8: error: unknown type name ‘size_t’
  407 | extern size_t strlen (const char *__s)
      |        ^~~~~~
/usr/include/string.h:413:8: error: unknown type name ‘size_t’
  413 | extern size_t strnlen (const char *__string, size_t __maxlen)
      |        ^~~~~~
/usr/include/string.h:413:46: error: unknown type name ‘size_t’
  413 | extern size_t strnlen (const char *__string, size_t __maxlen)
      |                                              ^~~~~~
/usr/include/string.h:413:46: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
In file included from /usr/include/features.h:490,
                 from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/string.h:26:
/usr/include/string.h:432:12: error: unknown type name ‘size_t’
  432 | extern int __REDIRECT_NTH (strerror_r,
      |            ^~~~~~~~~~~~~~
/usr/include/string.h:432:12: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
In file included from /usr/include/string.h:462:
/usr/include/strings.h:34:54: error: unknown type name ‘size_t’
   34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
      |                                                      ^~~~~~
/usr/include/strings.h:24:1: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
   23 | #include <stddef.h>
  +++ |+#include <stddef.h>
   24 | 
/usr/include/strings.h:38:53: error: unknown type name ‘size_t’
   38 | extern void bcopy (const void *__src, void *__dest, size_t __n)
      |                                                     ^~~~~~
/usr/include/strings.h:38:53: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/strings.h:42:31: error: unknown type name ‘size_t’
   42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
      |                               ^~~~~~
/usr/include/strings.h:42:31: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/strings.h:120:61: error: unknown type name ‘size_t’
  120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
      |                                                             ^~~~~~
/usr/include/strings.h:120:61: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/strings.h:134:27: error: unknown type name ‘size_t’
  134 |                           size_t __n, locale_t __loc)
      |                           ^~~~~~
/usr/include/strings.h:134:27: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:466:40: error: unknown type name ‘size_t’
  466 | extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1))
      |                                        ^~~~~~
/usr/include/string.h:466:40: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:497:55: error: unknown type name ‘size_t’
  497 |                         const char *__restrict __src, size_t __n)
      |                                                       ^~~~~~
/usr/include/string.h:497:55: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/string.h:500:53: error: unknown type name ‘size_t’
  500 |                       const char *__restrict __src, size_t __n)
      |                                                     ^~~~~~
/usr/include/string.h:500:53: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
tnc.c:8: warning: "NULL" redefined
    8 | #define NULL     0
      | 
In file included from /usr/include/string.h:33:
/usr/lib/gcc/x86_64-redhat-linux/12/include/stddef.h:404: note: this is the location of the previous definition
  404 | #define NULL ((void *)0)
      | 
tnc.c:320:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
  320 | main(argc, argv)
      | ^~~~
tnc.c: In function ‘main’:
tnc.c:332:3: error: unknown type name ‘FILE’
  332 |   FILE *fd;
      |   ^~~~
tnc.c:4:1: note: ‘FILE’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
    3 | #include <math.h>
  +++ |+#include <stdio.h>
    4 | 
tnc.c:335:5: warning: implicit declaration of function ‘fprintf’ [-Wimplicit-function-declaration]
  335 |     fprintf(stderr, "Usage: %s [outfile]\n", argv[0]);
      |     ^~~~~~~
tnc.c:335:5: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
tnc.c:335:5: warning: incompatible implicit declaration of built-in function ‘fprintf’ [-Wbuiltin-declaration-mismatch]
tnc.c:335:5: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
tnc.c:335:13: error: ‘stderr’ undeclared (first use in this function)
  335 |     fprintf(stderr, "Usage: %s [outfile]\n", argv[0]);
      |             ^~~~~~
tnc.c:335:13: note: ‘stderr’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
tnc.c:335:13: note: each undeclared identifier is reported only once for each function it appears in
tnc.c:336:5: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
  336 |     exit(-1);
      |     ^~~~
tnc.c:4:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
    3 | #include <math.h>
  +++ |+#include <stdlib.h>
    4 | 
tnc.c:336:5: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
  336 |     exit(-1);
      |     ^~~~
tnc.c:336:5: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
tnc.c:339:8: warning: implicit declaration of function ‘fopen’ [-Wimplicit-function-declaration]
  339 |   fd = fopen(argv[1], "w");
      |        ^~~~~
tnc.c:339:8: note: ‘fopen’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
tnc.c:339:6: warning: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  339 |   fd = fopen(argv[1], "w");
      |      ^
tnc.c:341:5: warning: incompatible implicit declaration of built-in function ‘fprintf’ [-Wbuiltin-declaration-mismatch]
  341 |     fprintf(stderr, "%s: Cannot open '%s' for output\n", argv[0], argv[1]);
      |     ^~~~~~~
tnc.c:341:5: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
tnc.c:342:5: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
  342 |     exit(-1);
      |     ^~~~
tnc.c:342:5: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
tnc.c:347:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
  347 |     printf("Enter UWP of source world: ");
      |     ^~~~~~
tnc.c:347:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
tnc.c:347:5: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
tnc.c:347:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
tnc.c:348:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
  348 |     scanf("%s", uwp);
      |     ^~~~~
tnc.c:348:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
tnc.c:348:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
tnc.c:348:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
tnc.c:363:15: warning: implicit declaration of function ‘cvt_hex’ [-Wimplicit-function-declaration]
  363 |   star_port = cvt_hex(uwp[0]);
      |               ^~~~~~~
tnc.c:370:3: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
  370 |   printf("Enter buyer's following skill levels (if no skill, enter 0):\n");
      |   ^~~~~~
tnc.c:370:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
tnc.c:375:7: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
  375 |       scanf("%d", &skill[i]);
      |       ^~~~~
tnc.c:375:7: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
tnc.c:376:7: warning: implicit declaration of function ‘fflush’ [-Wimplicit-function-declaration]
  376 |       fflush(stdout);
      |       ^~~~~~
tnc.c:376:14: error: ‘stdout’ undeclared (first use in this function)
  376 |       fflush(stdout);
      |              ^~~~~~
tnc.c:376:14: note: ‘stdout’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
tnc.c:385:3: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
  385 |   scanf("%s", str);
      |   ^~~~~
tnc.c:385:3: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
tnc.c:397:18: warning: implicit declaration of function ‘yes_or_no’ [-Wimplicit-function-declaration]
  397 |     amber_zone = yes_or_no(str[0]);
      |                  ^~~~~~~~~
tnc.c:414:10: error: ‘stdin’ undeclared (first use in this function)
  414 |   fflush(stdin);
      |          ^~~~~
tnc.c:414:10: note: ‘stdin’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
tnc.c:415:3: warning: implicit declaration of function ‘get_trade_codes’ [-Wimplicit-function-declaration]
  415 |   get_trade_codes();
      |   ^~~~~~~~~~~~~~~
tnc.c:428:15: warning: implicit declaration of function ‘random’ [-Wimplicit-function-declaration]
  428 |     hi_psg += random(6);
      |               ^~~~~~
tnc.c:474:3: warning: incompatible implicit declaration of built-in function ‘fprintf’ [-Wbuiltin-declaration-mismatch]
  474 |   fprintf(fd, "Available Passengers:\n");
      |   ^~~~~~~
tnc.c:474:3: note: include ‘<stdio.h>’ or provide a declaration of ‘fprintf’
tnc.c:646:3: warning: implicit declaration of function ‘fclose’ [-Wimplicit-function-declaration]
  646 |   fclose(fd);
      |   ^~~~~~
tnc.c: At top level:
tnc.c:709:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
  709 | get_trade_codes()
      | ^~~~~~~~~~~~~~~
tnc.c: In function ‘get_trade_codes’:
tnc.c:719:5: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
  719 |     printf("Enter trade codes for src. world: ");
      |     ^~~~~~
tnc.c:719:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
tnc.c:720:14: warning: implicit declaration of function ‘fgets’ [-Wimplicit-function-declaration]
  720 |     status = fgets(line, 81, stdin);
      |              ^~~~~
tnc.c:720:30: error: ‘stdin’ undeclared (first use in this function)
  720 |     status = fgets(line, 81, stdin);
      |                              ^~~~~
tnc.c:720:30: note: ‘stdin’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’?
tnc.c: At top level:
tnc.c:792:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
  792 | random(n)       /* generate a number from 1 to n, n < 1.0EE6 */
      | ^~~~~~
tnc.c: In function ‘random’:
tnc.c:799:17: warning: implicit declaration of function ‘srand’ [-Wimplicit-function-declaration]
  799 |                 srand((unsigned int) time((long *)0));
      |                 ^~~~~
tnc.c:799:38: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
  799 |                 srand((unsigned int) time((long *)0));
      |                                      ^~~~
tnc.c:4:1: note: ‘time’ is defined in header ‘<time.h>’; did you forget to ‘#include <time.h>’?
    3 | #include <math.h>
  +++ |+#include <time.h>
    4 | 
tnc.c:802:25: warning: implicit declaration of function ‘rand’; did you mean ‘random’? [-Wimplicit-function-declaration]
  802 |         fval = ((float) rand()) / MAX_RAND;
      |                         ^~~~
      |                         random
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant