bobmon@iucs.UUCP (10/30/87)
[ My apologies if this posting annoys anyone, but I can't even mail to myself with any success these days... ] 164485913@excalibur.UUCP (Mark Schaffer) writes: >Has anyone out there in Netland been able to successfully compile either >MicroEMACS 3.9 or MicroSPELL 1.0 using Turbo C 1.00? I have just received >the sources to both emacs and spell and have been unable to successfully >link the .obj files to make the executable files. I get many "Linker Error: >undefined symbol '_foo' in module MAIN.C" errors. > >Since I am very much a novice when C is concerned, I may be doing something >quite fundamentally wrong when compiling the programs. Before I compile the >program, I changed the appropriate #define statements to indicate that I am >compiling with Turbo C on an MS-DOS, IBM-type machine in the estruct.h and >dopt.h files. I then load and compile the main.c files for the programs. I assume that you literally mean you are compiling only the main.c files. The myriad linker errors are then due to the fact that most of the program is in all those other files. You must compile all of them, and link them all together. The easiest method (by far) is simply to give TC a .PRJ file defining all the files to be compiled and linked. The one I use follows: basic.c (estruct.h, edef.h) bind.c (estruct.h, edef.h, epath.h) buffer.c (estruct.h, edef.h) crypt.c (estruct.h, edef.h) display.c (estruct.h, edef.h) eval.c (estruct.h, edef.h, evar.h) exec.c (estruct.h, edef.h) file.c (estruct.h, edef.h) fileio.c (estruct.h, edef.h) ibmpc.c (estruct.h, edef.h) input.c (estruct.h, edef.h) isearch.c (estruct.h, edef.h) line.c (estruct.h, edef.h) main.c (estruct.h, edef.h, efunc.h, ebind.h) random.c (estruct.h, edef.h) region.c (estruct.h, edef.h) search.c (estruct.h, edef.h) spawn.c (estruct.h, edef.h) termio.c (estruct.h, edef.h) window.c (estruct.h, edef.h) word.c (estruct.h, edef.h) z309.c (estruct.h, edef.h) Given this, tc will compile all of these, then link them together, and produce an executable file. This will take long enough that you can make some coffee, take out the garbage, attend to personal hygiene...:-) but eventually you should have an executable. Expect it to be about 90k bytes long. It must be compiled with Large memory model. I have all the optimiz- ation options turned on, and it isn't bombing on me. (If you're on a '286 machine or one with a V20 CPU chip, you can compile to 80186/80286 code. This will give you a warm feeling and an insignificant improvement in the program produced.) Notes on the above .PRJ file: the files in parentheses are files upon which the respective .C files depend. That is, if edef.h is changed, all the .C files must/will be recompiled, whether they've been changed or not. Also, microemacs is written so that all the various display drivers can be compiled, and the inappropriate ones will contribute nothing. I was lazy, so I've only included the two drives I might actually use (ibmpc.c and z309.c). If you're using TurboC, these two and possibly rainbow.c are the most likely ones you'll really need. Whew. Okay -- The spawncli function in spawn.c fires up a sub-shell. TurboC has been lumped in with Aztec and MSC for issuing the system call that starts the sub-shell, but these compilers try to execute "command.com". On my system, microemacs apparently can't find command.com, so the function fails. The LATTICE version must have the same problem; it executes "\\command.com" instead, which also works for TurboC -- but LATTICE's system call has a bit different syntax than Turbo, so they can't use the same "#ifdef" code. AND... since I was fixing it anyway, I made it look in the environment for a user- specified shell, as the V7/BSD/USG code does. So anyway, here are the changes I made, and I hope someone out there enjoys 'em.... ***** spawn.c 57: 58: #if V7 | USG | BSD 59: register char *cp; ***** newspawn.c 57: 58: #if V7 | USG | BSD | TURBO 59: register char *cp; ***** ***** spawn.c 86: #endif 87: #if MSDOS & (AZTEC | MSC | TURBO) 88: movecursor(term.t_nrow, 0); /* Seek to last line. */ ***** newspawn.c 86: #endif 87: #if MSDOS & (AZTEC | MSC) 88: movecursor(term.t_nrow, 0); /* Seek to last line. */ ***** ***** spawn.c 104: #endif 105: #if V7 | USG | BSD ***** newspawn.c 104: #endif 105: 106: #if MSDOS & TURBO 107: movecursor(term.t_nrow, 0); /* Seek to last line. */ 108: TTflush(); 109: TTkclose(); 110: /* 111: * Try for a user-defined command-line interpreter. If none, 112: * look in the DOS-defined variable in case COMMAND.COM is in 113: * a strange location (or strange name). If that's missing 114: * for some reason, go with the mindless default. 115: */ 116: if ((cp = getenv("SHELL")) != NULL && *cp != '\0') 117: system(cp); 118: else if ((cp = getenv("COMSPEC")) != NULL && *cp != '\0') 119: system(cp); 120: else 121: system("\\command.com"); /* Run default CLI. */ 122: TTkopen(); 123: sgarbf = TRUE; 124: return(TRUE); 125: #endif 126: 127: #if V7 | USG | BSD ***** ***** ~-~-~-~-~ "Have you hugged ME today?" RAMontante Computer Science Dept. might be --> bobmon@iucs.cs.indiana.edu Indiana University or maybe --> montante@silver.BACS.indiana.edu