Mail Archives: djgpp/2001/01/20/14:21:32
From: | "Rafal Maj" <maj_rafal AT poczta DOT onet DOT pl>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Odp: Library with templates - help !!!!!!!!!!!!!
|
Date: | Sat, 20 Jan 2001 19:57:26 +0100
|
Organization: | Academic Computer Center CYFRONET AGH
|
Lines: | 75
|
Message-ID: | <94cn4v$a4r$1@info.cyf-kr.edu.pl>
|
References: | <3A69F3B9 DOT 12173 DOT 67F409 AT localhost>
|
NNTP-Posting-Host: | d-94-53-12.cyfronet.krakow.pl
|
Mime-Version: | 1.0
|
X-Trace: | info.cyf-kr.edu.pl 980017119 10395 149.156.1.172 (20 Jan 2001 18:58:39 GMT)
|
X-Complaints-To: | news AT cyf-kr DOT edu DOT pl
|
NNTP-Posting-Date: | 20 Jan 2001 18:58:39 GMT
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2615.200
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Thanks
So, In djgpp C++ I can use library as *.cc + *.h file, until I will use
templates, and yet ther isn't any way to use templates in librarys ?
P.S. What for are options like -frepo, -falt-external-templates ?
Użytkownik <pavenis AT lanet DOT lv> w wiadomooci do grup dyskusyjnych
napisał:3A69F3B9 DOT 12173 DOT 67F409 AT localhost...
> On 20 Jan 2001, at 14:21, Rafal Maj wrote:
>
> > Hi,
> > I have problem when I compile program using library with templates.
> > Project file contains bugmain.cc & bug.cc. In this example, bugmain.cc
is my
> > mian program, bug.cc is my library & bug.h is library header. I have
> > problems to build my program when I'm using templates in my library.
> > I get error report :
> >
> > Compiling: bugmain.cc
> > no errors
> > Creating: bug.exe
> > Error: bugmain.o: In function `main':
> > bugmain.cc(2) Error: undefined reference to `box<int>::move(int)'
> > There were some errors
> >
> > Box is my template class and move is simple function inside bug
ctemplate
> > class.
> > Can somebody help me ???????
> >
> > I know, that there are options like -frepo, no-implict-templates, etc...
but
> > I realy don't know how to set them to make my exaple work.
> >
> > If You can help me, please write exacly what should be compiler & linker
> > options, and what I have to change inside my source files.
> > Maybe You can correct my project file, then send it to me
> > maj_rafal AT poczta DOT onet DOT pl )?
> >
> > ============ PROJECT WINDOW ==========
> > bug.cc
> > bugmain.cc
> > ================== BUG.CC ================
> > template <class typ> void box<typ>::move(typ d) {
> > x+=d; y+=d;
> > }
>
> Compiler should see this code (bug.cc) when compiling bugmain.cc.
> C++ standard includes keyword 'export' (not implemented in GCC yet,
> don't ask me when this will happen ...) for separate compilation
> of templates.
>
> So append contents of bug.cc to bug.h and all should be OK
>
> > ================== BUGMAIN.CC =================
> > #include "bug.h"
> > main() {
> > box<int> b;
> > b.move(5);
> > }
> > ================== BUG.H ===============
> > template <class typ>
> > class box {
> > public :
> > typ x,y;
> > void move(typ d);
> > };
> > =========================================================
> >
> > Thanks in advice ;-)
> > Rafa
> >
>
- Raw text -