home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19763 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.6 KB

  1. Path: sparky!uunet!gatech!prism!mhopper
  2. From: mhopper@cerl.gatech.edu (Michael A. Hopper)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Was: Template Use <sigh>
  5. Message-ID: <81348@hydra.gatech.EDU>
  6. Date: 22 Jan 93 17:49:18 GMT
  7. References: <1jp50dINNk34@rs6000.bham.ac.uk>
  8. Sender: news@prism.gatech.EDU
  9. Organization: Computer Engineering Research Lab, Georgia Tech.
  10. Lines: 35
  11.  
  12. In article <1jp50dINNk34@rs6000.bham.ac.uk> pickerig@eee.bham.ac.uk (Guy Pickering) writes:
  13. ->Anyway, my problem in more detail is this: I have three directories
  14. ->which contain the following:
  15. ->
  16. ->  1/ The .C and .H files defining the template class LookupTable.
  17. ->  2/ The .C and .H files of an algorithm which uses LookupTable<unsigned
  18. ->     char>
  19. ->  3/ A main.C which binds the whole lot together, but does not itself
  20. ->     use LookupTable<unsigned char>
  21. ->
  22. ->The problem is that at link time, no template instantiation takes
  23. ->place and then the real linker complains about all my member functions
  24. ->of LookupTable<unsigned char> being unresolved.
  25. ->
  26. ->There are unresolved symbols, yet the instantiator doesn't do anything
  27. ->about them.
  28. ->
  29. ->What am I doing wrong??? Any ideas?
  30. ->
  31. ->Guy. 
  32.  
  33. Put ALL of your template code in header (.h) files.  Do not put template
  34. code (member functions) in .c files.  In other words, get rid of loopuptable.c
  35. (or whatever you called it).
  36.  
  37. This worked for me.
  38.  
  39. -Mike
  40.  
  41.  
  42. -- 
  43. | mhopper@cerl.gatech.edu |   ' ) ) ) o  /_       ' )  /   ROLL TIDE !!!
  44. | Office: CRB 388         |    / / / /  /\_) __    /__/______   _   __  __
  45. | Phone: (404) 894-9111   |   / / (_/\_/  \_/_/_  /  / (_) /_)_/_)_/_/_/ (_
  46. | Home:  (404) 723-1718   | ALABAMA: 1993 Nat'l Champs    /   / how Sweet it is!
  47.