Problem with the comm.c.........

Posted by Cyrill on Wed 22 May 2002 08:13 AM — 4 posts, 16,475 views.

#0
$ make > test
gcc -c -Wall -O -g act_comm.c
gcc -c -Wall -O -g act_info.c
act_info.c: In function `do_look':
act_info.c:1126: warning: suggest explicit braces to avoid ambiguous `else'
act_info.c:1135: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -Wall -O -g act_move.c
gcc -c -Wall -O -g act_obj.c
act_obj.c: In function `do_put':
act_obj.c:427: warning: suggest explicit braces to avoid ambiguous `else'
act_obj.c:465: warning: suggest explicit braces to avoid ambiguous `else'
act_obj.c: In function `get_cost':
act_obj.c:2484: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -Wall -O -g act_wiz.c
gcc -c -Wall -O -g alias.c
gcc -c -Wall -O -g ban.c
gcc -c -Wall -O -g comm.c
comm.c:212: conflicting types for `gettimeofday'
c:/djgpp/include/time.h:86: previous declaration of `gettimeofday'
comm.c: In function `close_socket':
comm.c:1104: warning: implicit declaration of function `close'
comm.c: In function `read_from_descriptor':
comm.c:1160: warning: implicit declaration of function `read'
comm.c:1176: `EWOULDBLOCK' undeclared (first use in this function)
comm.c:1176: (Each undeclared identifier is reported only once
comm.c:1176: for each function it appears in.)
comm.c: In function `write_to_descriptor':
comm.c:1624: warning: implicit declaration of function `write'
make.exe: *** [comm.o] Error 1

I downloaded the rom code, ported me believe, and used the makefile that was suggested, what I got was an error on the comm.c, telling me that, to the best of my knowledge, something is undeclared, or declared in a way that is messing the whole thing up.. Here's my makefile too:

<pre>

CC = gcc
PROF = -O -g
NOCRYPT =
C_FLAGS = -Wall $(PROF) $(NOCRYPT)
L_FLAGS = $(PROF)

O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o alias.o \
ban.o comm.o const.o db.o effects.o fight.o \
handler.o hunt.o interp.o magic.o \
music.o note.o races.o recycle.o \
save.o skills.o special.o tables.o update.o \

rom: $(O_FILES)
rm -f rom
$(CC) $(L_FLAGS) -o rom $(O_FILES)

.c.o: merc.h
$(CC) -c $(C_FLAGS) $<
</pre>
Australia Forum Administrator #1
Which ROM did you use exactly? Which operating system are you using? Cygwin or something else?
#2
I am using windows 95, with cygwin. As to the rom code, I used a win port from a friend, and then downloaded the one from this site, and have not been able to figure out exactly what is wrong with the comm.c... I'm currently on a amd-k6, 200mhz machine with 16 meg ram, and not a clue as to why I didn't a clean compile. Also, I changed the makefile I had to match yours, and still came up against the error.
Amended on Wed 22 May 2002 08:36 AM by Cyrill
Australia Forum Administrator #3
The missing things sound like they are from these include files:


#if defined(unix)
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include "telnet.h"
const   char    echo_off_str    [] = { IAC, WILL, TELOPT_ECHO, '\0' };
const   char    echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' };
const   char    go_ahead_str    [] = { IAC, GA, '\0' };
#endif


They won't be included if "unix" is not defined.

In the file "Makefile" make sure this line is there, with the -Dunix at the end ...


C_FLAGS = -Wall $(PROF) $(NOCRYPT) -Dunix