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