www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/07/06:00:11

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Raf256 <raf256 AT go2 DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: templates export ?
Date: 7 Dec 2001 09:18:01 GMT
Organization: aa
Lines: 32
Sender: raf256 AT poczta DOT onet DOT pl@chello062179025129.chello.pl
Message-ID: <Xns9170695B2B754rfdfciasdsdj412tr@213.180.128.20>
NNTP-Posting-Host: chello062179025129.chello.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1007716681 2396 62.179.25.129 (7 Dec 2001 09:18:01 GMT)
X-Complaints-To: abuse AT onet DOT pl
NNTP-Posting-Date: 7 Dec 2001 09:18:01 GMT
User-Agent: Xnews/4.06.22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sorry for such a lame question, but it's first time im using templates in 
bigger project. I have problems with external templates, afair this problem 
was connected to 'export' (?) and solving it in 'nice' way was impossible 
until release of GCC 3.02

I have project like : (I'm writting from mmemory) 
--- lib.h ---
template <class typ> class cTest { public : typ a; cTest(); };

--- lib.cpp ---
#include "lib.h"
template <class typ> cTest<typ>::cTest() { a=0; }

--- main.cpp ---
#include "lib.h"
int main() { cTest<float> a; }

Project file has 2 sources : lib.cpp and main.cpp

Compile is ok, but linker reports that he can't find cTest<float>::cTest();
Ofcourse if I would put all 3 files into one and if I didnt use project - 
everything would be ok.

How can I solve this problem (how to use template class from my library) 

Thanks !

-- 
Raf256 ##############################################################
,--, _  ,-   _  _  _  ###############################################
|,-'`_|_|_  `_||_'|_' # raf256 AT go2 DOT pl ## :( #########################
| `\|_| |   |_,,_||_| ###############################################

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019