Help please.

Posted by DarkAura on Wed 15 Oct 2003 04:07 AM — 4 posts, 14,484 views.

#0
i'm getting these errors

comm.c:86: warning: conflicting types for built-in function `log'
comm.c:969:1: missing terminating " character
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: parse error before "r"
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: parse error before "r"
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:975:41: missing terminating " character
comm.c:992: error: parse error before string constant
comm.c:992: error: conflicting types for `log'
comm.c:86: error: previous declaration of `log'
comm.c:992: warning: data definition has no type or storage class
comm.c:994: error: parse error before '(' token
comm.c:1002: error: `input_set' undeclared here (not in a function)
comm.c:1002: error: parse error before "for"
comm.c:1009: error: parse error before numeric constant
comm.c:1009: warning: data definition has no type or storage class
comm.c:1016: error: parse error before numeric constant
comm.c:1016: warning: data definition has no type or storage class
comm.c:1022: error: parse error before numeric constant
comm.c:1022: warning: data definition has no type or storage class
comm.c:1023: warning: parameter names (without types) in function declaration
comm.c:1023: warning: data definition has no type or storage class
comm.c:1024: error: parse error before '}' token
comm.c:1027: error: redefinition of `tics'
comm.c:59: error: `tics' previously defined here
comm.c:1027: warning: data definition has no type or storage class
comm.c:1028: error: parse error before "if"
comm.c:1031: error: parse error before numeric constant
comm.c:1031: warning: data definition has no type or storage class
comm.c:1036: error: parse error before string constant
comm.c:1036: warning: data definition has no type or storage class
comm.c:1037: error: parse error before numeric constant
comm.c:1037: warning: data definition has no type or storage class
make: *** [comm.o] Error 1
void point_update( void ); /* In limits.c */
void free_char(struct char_data *ch);
void log(char *str);
void mobile_activity(void);
void string_add(struct descriptor_data *d, char *str); that is for the 86
84. void point_update( void ); /* In limits.c */
85. void free_char(struct char_data *ch);
86. void log(char *str);
87. void mobile_activity(void);
88. void string_add(struct descriptor_data *d, char *str);
968. #define COMA_SIGN \
969. "\n\r\
970. DikuMUD is currently inactive due to excessive load on the host machine.\n\r\
971. Please try again later.\n\r\n
972. \n\r\
973. Sadly,\n\r\
974. \n\r\
975. the DikuMUD system operators\n\r\n\r"
#1
989. int workhours(void);
990. int load(void);
991.
992. log("Entering comatose state.");
993.
994. sigsetmask(sigmask(SIGUSR1) | sigmask(SIGUSR2) | sigmask(SIGINT) |
995. sigmask(SIGPIPE) | sigmask(SIGALRM) | sigmask(SIGTERM) |
996. sigmask(SIGURG) | sigmask(SIGXCPU) | sigmask(SIGHUP));
997.
998.
999. while (descriptor_list)
1000. close_socket(descriptor_list);
1001.
1002. FD_ZERO(&input_set);
1003. do
1004. {
1005. FD_SET(s, &input_set);
1006. if (select(64, &input_set, 0, 0, &timeout) < 0)
1007. {
1008. perror("coma select");
1009. exit(1);
1010. }
1011. if (FD_ISSET(s, &input_set))
1012. {
1013. if (load() < 6)
1014. {
1015. log("Leaving coma with visitor.");
1016. sigsetmask(0);
1017. return;
1018. }
1019. if ((conn = new_connection(s)) >= 0)
1020. {
1021. write_to_descriptor(conn, COMA_SIGN);
1022. sleep(2);
1023. close(conn);
1024. }
1025. }
1026.
1027. tics = 1;
1028. if (workhours())
1029. {
1030. log("Working hours collision during coma. Exit.");
1031. exit(0);
1032. }
1033. }
1034. while (load() >= 6);
1035.
1036. log("Leaving coma.");
1037. sigsetmask(0);
1038. }

gcc -c -g comm.c
comm.c:86: warning: conflicting types for built-in function `log'
comm.c:969:1: missing terminating " character
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: parse error before "r"
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: parse error before "r"
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:972: error: stray '\' in program
comm.c:975:41: missing terminating " character
comm.c:992: error: parse error before string constant
comm.c:992: error: conflicting types for `log'
comm.c:86: error: previous declaration of `log'
comm.c:992: warning: data definition has no type or storage class
comm.c:994: error: parse error before '(' token
comm.c:1002: error: `input_set' undeclared here (not in a function)
comm.c:1002: error: parse error before "for"
comm.c:1009: error: parse error before numeric constant
comm.c:1009: warning: data definition has no type or storage class
comm.c:1016: error: parse error before numeric constant
comm.c:1016: warning: data definition has no type or storage class
comm.c:1022: error: parse error before numeric constant
comm.c:1022: warning: data definition has no type or storage class
comm.c:1023: warning: parameter names (without types) in function declaration
comm.c:1023: warning: data definition has no type or storage class
comm.c:1024: error: parse error before '}' token
comm.c:1027: error: redefinition of `tics'
comm.c:59: error: `tics' previously defined here
comm.c:1027: warning: data definition has no type or storage class
comm.c:1028: error: parse error before "if"
comm.c:1031: error: parse error before numeric constant
comm.c:1031: warning: data definition has no type or storage class
comm.c:1036: error: parse error before string constant
comm.c:1036: warning: data definition has no type or storage class
comm.c:1037: error: parse error before numeric constant
comm.c:1037: warning: data definition has no type or storage class
make: *** [comm.o] Error 1
USA #2
This is not right:

968. #define COMA_SIGN \
969. "\n\r\
970. DikuMUD is currently inactive due to excessive load on the host machine.\n\r\
971. Please try again later.\n\r\n
972. \n\r\
973. Sadly,\n\r\
974. \n\r\
975. the DikuMUD system operators\n\r\n\r"

It should be:

968. #define COMA_SIGN \
969. "\n\r\
970. DikuMUD is currently inactive due to excessive load on the host machine.\n\r\
971. Please try again later.\n\r\n\
972. \n\r\
973. Sadly,\n\r\
974. \n\r\
975. the DikuMUD system operators\n\r\n\r"

This is, however, not good practice... it would be better to make it just one line, without using the \ continue-to-next-line indicator.


Also, about the log function, is that something you added? It seems that it's having a conflict with the built in log (i.e. logarithm) function.
USA #3
The conflicting types message is going to come up more and more since many common codebases used log() as the name of their generic logging function. As more and more servers update to gcc 3.3.x this will become an issue. It already has for me and AFKMud because I tend to stay on the bleeding edge of compilers as soon as they're available.