Compiling with DJGPP?

Posted by Kimasxi on Mon 07 Apr 2003 04:15 PM — 6 posts, 19,590 views.

#0
Okay folks, this is gonna be pretty messy.

First things first, I'm pretty much a newbie to this stuff. I'll admit it. I've done some coding and compiling with Linux but that was a few years ago and I don't remember much. I learn best by doing, though, so here I am.

And here's my story:
I downloaded DJGPP the other day along with the bugfixed version of the Smaug source. It works just fine until it gets to comm.c, and then I get all sorts of error messages. I've spent the last twenty minutes or so trying to figure out how to get it to dump them into a file so I could actually read them all, but I still can't make heads or tails of it.

It's kind of long, so forgive me, but here's what I got:

comm.c:56:26: sys/socket.h: No such file or directory (ENOENT)
comm.c:58:32: netinet/in_systm.h: No such file or directory (ENOENT)
comm.c:59:26: netinet/ip.h: No such file or directory (ENOENT)
comm.c:60:25: arpa/inet.h: No such file or directory (ENOENT)
comm.c:61:27: arpa/telnet.h: No such file or directory (ENOENT)
comm.c:62:21: netdb.h: No such file or directory (ENOENT)
comm.c:70: `IAC' undeclared here (not in a function)
comm.c:70: initializer element is not constant
comm.c:70: (near initialization for `echo_off_str[0]')
comm.c:70: `WILL' undeclared here (not in a function)
comm.c:70: initializer element is not constant
comm.c:70: (near initialization for `echo_off_str[1]')
comm.c:70: `TELOPT_ECHO' undeclared here (not in a function)
comm.c:70: initializer element is not constant
comm.c:70: (near initialization for `echo_off_str[2]')
comm.c:71: `IAC' undeclared here (not in a function)
comm.c:71: initializer element is not constant
comm.c:71: (near initialization for `echo_on_str[0]')
comm.c:71: `WONT' undeclared here (not in a function)
comm.c:71: initializer element is not constant
comm.c:71: (near initialization for `echo_on_str[1]')
comm.c:71: `TELOPT_ECHO' undeclared here (not in a function)
comm.c:71: initializer element is not constant
comm.c:71: (near initialization for `echo_on_str[2]')
comm.c:72: `IAC' undeclared here (not in a function)
comm.c:72: initializer element is not constant
comm.c:72: (near initialization for `go_ahead_str[0]')
comm.c:72: `GA' undeclared here (not in a function)
comm.c:72: initializer element is not constant
comm.c:72: (near initialization for `go_ahead_str[1]')
comm.c: In function `init_socket':
comm.c:332: storage size of `sa' isn't known
comm.c:339: warning: implicit declaration of function `socket'
comm.c:339: `AF_INET' undeclared (first use in this function)
comm.c:339: (Each undeclared identifier is reported only once
comm.c:339: for each function it appears in.)
comm.c:339: `SOCK_STREAM' undeclared (first use in this function)
comm.c:345: warning: implicit declaration of function `setsockopt'
comm.c:345: `SOL_SOCKET' undeclared (first use in this function)
comm.c:345: `SO_REUSEADDR' undeclared (first use in this function)
comm.c:374: warning: implicit declaration of function `bind'
comm.c:381: warning: implicit declaration of function `listen'
comm.c:332: warning: unused variable `sa'
comm.c: In function `new_descriptor':
comm.c:764: storage size of `sock' isn't known
comm.c:781: warning: implicit declaration of function `accept'
comm.c:804: `O_NDELAY' undeclared (first use in this function)
comm.c:829: warning: implicit declaration of function `inet_ntoa'
comm.c:829: warning: passing arg 2 of `strcpy' makes pointer from integer without a cast
comm.c:837: warning: implicit declaration of function `gethostbyaddr'
comm.c:838: `AF_INET' undeclared (first use in this function)
comm.c:838: warning: assignment makes pointer from integer without a cast
comm.c:839: dereferencing pointer to incomplete type
comm.c:764: warning: unused variable `sock'
comm.c: In function `read_from_descriptor':
comm.c:1065: warning: implicit declaration of function `recv'
comm.c:1083: `EWOULDBLOCK' undeclared (first use in this function)
comm.c: In function `write_to_descriptor':
comm.c:1390: warning: implicit declaration of function `send'
comm.c:1399: `EWOULDBLOCK' undeclared (first use in this function)
comm.c: In function `nanny':
comm.c:1663: warning: implicit declaration of function `crypt'
comm.c:1663: warning: passing arg 1 of `strcmp' makes pointer from integer without a cast
comm.c:1755: warning: assignment makes pointer from integer without a cast
comm.c:1776: warning: passing arg 1 of `strcmp' makes pointer from integer without a cast

I have no idea what most of that means...is there something I'm missing or should I just get a new compiler? (I'd rather not have to do that, it's not an easy task with the limited hd space I've got.)

I'd really appreciate any help/ideas/suggestions/pointing out the obvious that anyone can give me, here.
Australia Forum Administrator #1
First, the missing includes sound like you either don't have those files, or they are in another place.

For a start, try changing sys/socket.h to just socket.h, that may work.

Second, I think the other errors are because it doesn't realise you are using Unix. Try defining unix (I think it is) in the make file (eg. -Dunix at the appropriate point), or adding a define to the start of comm.c, like this:

#define unix 1

#2
Uhm..I'm not using Unix, I'm using Win98, and I think I may have found the problem, after going and looking at the ROM boards earlier today. I think I'm either missing the files altogether or they're called something else with Djgpp because I did a search for the filenames, and didn't come up with anything. Is it reasonable for me to think that they might have different names with a different compiler?

I guess I'll start looking through all the h files.
Australia Forum Administrator #3
Yes, so far so good. I understand you aren't using Unix, however if you look at the start of comm.c there are some bits of code that define various things if you have unix, win32, etc. defined. However if *none* are defined then they are omitted, leading to the error messages you are getting.

#4
Ahh, alright. I found out that I was indeed missing all of those files so I went and found 'em on the net, which cut down my error log to almost nothing, but now there seems to be a whole bunch of parse errors in ip.h and in_systm.h.
Australia Forum Administrator #5
Personally I wouldn't find those files "on the net" unless they are for your exact compiler and system. Each compiler and operating system tends to have different implementations of things like IP functions. I would look on the hard disk for the files that came with your compiler. They may already be there, but in a different directory.

Also, you may get away with omitting (some of) them altogether. That worked for me under the MS VC++ compile, because some of the symbols were defined in other .h files.