home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18464 < prev    next >
Encoding:
Internet Message Format  |  1992-12-28  |  1.2 KB

  1. From: defaria@hpcuhe.cup.hp.com (Andy DeFaria)
  2. Date: Mon, 28 Dec 1992 08:47:24 GMT
  3. Subject: Problem with BC++ 3.0 TLINK and missing symbols
  4. Message-ID: <33820012@hpcuhe.cup.hp.com>
  5. Organization: Hewlett Packard, Cupertino
  6. Path: sparky!uunet!munnari.oz.au!spool.mu.edu!nigel.msen.com!sdd.hp.com!col.hp.com!news.dtc.hp.com!hpscit.sc.hp.com!hplextra!hpcss01!hpcuhe!defaria
  7. Newsgroups: comp.lang.c++
  8. Lines: 41
  9.  
  10. I have been receiving errors from Borland C++ 3.0 of the form:
  11.  
  12.  
  13. Linker Error: Undefined symbol foo<int>::foobar() in module BAR.C
  14.  
  15. given the following files:
  16.  
  17. FOO.H:
  18. ------
  19. template <class TYPE>
  20. class foo {
  21.    private:
  22.       int i;
  23.    public:
  24.       void foobar (void);
  25. };
  26.  
  27. FOO.C:
  28. ------
  29. #include "foo.h"
  30.  
  31. template <class TYPE>
  32. void foo<TYPE>::foobar (void) {
  33.   i++;
  34. } // foobar
  35.  
  36. BAR.C:
  37. ------
  38. #include "foo.h"
  39.  
  40. void main (void) {
  41.    foo<int> x;
  42.  
  43.    x.foobar ();
  44. } // main
  45.  
  46. These example is a chopped down version of the real one that I had originally
  47. had had problems with.  Notice that there is no need for a template anymore as
  48. TYPE is not really used.  I am using Borland C++ 3.0 and in the IDE I create a
  49. project file that has both FOO.C and BAR.C.  Every thing compiles but fails to
  50. link with the above message.  Why?
  51.