delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/22/09:30:29

From: Jean-Michel Brissiaud <brissiau AT miage DOT isi DOT u-psud DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: template problems
Date: Mon, 22 Sep 1997 12:37:23 +0100
Organization: M.I.A.G.E Universite d'Orsay
Lines: 14
Message-ID: <34265873.41C6@miage.isi.u-psud.fr>
References: <34263F31 DOT 433CE30B AT cs DOT curtin DOT edu DOT au>
NNTP-Posting-Host: cfa.isi.u-psud.fr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gordon German wrote:
> PS. I have since tried a small test program which calls the
> implimentation file:
> 
>     #include "matrix.cc"
> 
> and matrix.cc includes matrix.h. This actually works, no errors. This
> trick doesn't seem to work for multi-file projects, however. You either
> get a "multiple define" error (if you include matrix.cc with each file 

If your matric.cc file constains function's body, when you use it in
multi-file projects, their body is defined each time.
To solve your problem create an object matrix.o in compiling matrix.cc
and include only matrix.h in your other .cc files.

- Raw text -


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