home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11771 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  1.6 KB

  1. Xref: sparky comp.os.msdos.programmer:11771 comp.lang.c:19161 alt.msdos.programmer:3080
  2. Path: sparky!uunet!stanford.edu!rutgers!cmcl2!panix!bergman
  3. From: bergman@panix.com (Mark Bergman)
  4. Newsgroups: comp.os.msdos.programmer,comp.lang.c,alt.msdos.programmer
  5. Subject: Makefile link order (Help!)
  6. Message-ID: <C0B1J0.ABn@panix.com>
  7. Date: 4 Jan 93 01:01:48 GMT
  8. Organization: Panix Public Access Internet & Unix, NYC
  9. Lines: 33
  10.  
  11. I'm pretty clueless about how the order of object files in a makefile
  12. is determined.
  13.  
  14. For example, I'm trying to "port" (simply recompile) the source to
  15. "agrep" using the DJGPP compiler. I consistently get errors along the
  16. lines of:
  17.  
  18.     preprocess.o: Undefined symbol _init referenced from text segment
  19.         ^^obj name^^                  ^funct^
  20.  
  21. Where "obj name" and "funct" change depending on the order that the
  22. object files are listed in the makefile. In this case, the function
  23. init() is defined in a module (follow.o) that is listed after
  24. preprocess.o in the makefile. Swithing the two produces more errors of
  25. the same sort, because follow.c depends on functions defined in
  26. preprocess.c.
  27.  
  28. Defining init() in preprocess.c (either with the same definition found
  29. in follow.c or as an extern) doesn't seem to help--I get the same error
  30. message.
  31.  
  32. Is there any way to determine the correct order of files in makefile.
  33. Why does it matter, doesn't the linker sort of throw all the functions
  34. into a blender and turn it on?
  35.  
  36. ** Replies via E-mail preferred and quickly acknowledged. **
  37.  
  38. ----
  39. Mark Bergman    (Biker, Stagehand, (former) Unix user support grunt)
  40. 718-855-9148
  41.  
  42. bergman@panix.com
  43. {cmcl2,uunet}!panix!bergman
  44.