Anne

I don't know the exact cause of your problem - but can suggest a solution as
I have had this problem before.  Put the implementation of class a into the
header file and don't bother with the .cpp file and it will link.  If anyone
can suggest a cause/proper solution then I would love to hear it.

Regards,

Fergal Moran
-- 
WASP Technologies
http://www.wasptech.com
Wireless Application Solutions Provider  

> -----Original Message-----
> From: Anne Srinivas [mailto:[EMAIL PROTECTED]]
> Sent: 03 August 2000 07:59
> To: Palm Developer Forum
> Subject: PROBLEMS USING TEMPLATE CLASSES
> 
> 
> Hai,
> I am trying to use template classes  in my application.
> I have 3 files.
>         1. Header.h  -- This is header file for class definition
>         2. Impl.cpp   -- This is implementation file for class in
> Header.h
>         3. Starter.cpp -- This is my main file
> 
>    The files are as follows :
> 
>         Header.h
>                     template <class Type>
>                     class a
>                     {
>                             public:
>                               int b;
>                               void add(int c,int d);
>                     };
> 
>         Impl.cpp
>         # include "Header.h"
>         template <class Stype> void a<Stype> ::add(int d,int l)
>         {
>               b=(d+l);
>          }
> 
>        Starter.cpp
>             // All includes....
>             #include "Header.h"
>             // All other functions....
>             // ......
>         case frmOpenEvent:
>       {
>           // All necessary code....
>           a<int> a1;
>           a1.add(12,13);
>           int  k=a1.b;
>         // All necessary code
>      }
> 
> Problem is that when i complie this code it's compling  with out a
> error.
> But when i try to link it its giving me a link error saying that
> a<int>::add(int,int) referenced from mainformhandleevent is undefined.
> 
> What is the problem?
> 
> Thanks in advance
> 
> Regards
> 
> --
> Anne Srinivas
> Software Engineer
> InfoTech Enterprises Ltd.
> Plot No 11,Infocity,
> Software Units Layout,
> Madhapur,Hyderabad 33
> 
> E-Mail :
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 
> Tel (Resi)   : 3033761
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
> 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to