🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42786

Template Instantiation using g++

#42786
From: Charles Sawyer
Date: Sun, 22 Oct 1995 00:00
39 lines
1414 bytes
Does the -fexternal-templates flag work?  I have a test case file:
#pragma implementation

template
<class T> class Wrapper {
	public:
	T t;
	Wrapper();
	T get();
} ;

template
<class T> Wrapper<T>::Wrapper() { t = 0; }

template
<class T> T Wrapper<T>::get() { return t; }

typedef Wrapper<int> IWrap;

When I compile it with the -fexternal-templates flag I still get
static definitions.  Here is the output of nm:

Symbols from tp.o:

Name                    Value   Scope  Type    Subspace

__t7Wrapper1Zi      |        52|static|entry  |$CODE$
get__t7Wrapper1Zi   |       100|static|entry  |$CODE$
__t7Wrapper1ZiRCt7Wrapper1Zi|         0|static|entry  |$CODE$
L$0                |         0|static|data   |$CODE$

I hope you can help.  I am teaching a C++ course here at the Harvard
Extension and many of the students are using g++ and expecting support
for templates.  

Regards,
	--Charlie

P.S. Please CC a reply to charles.sawyer@fmr.com
Technical Details
Message-ID: <199510230233.WAA23846@course1.harvard.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,94e43c53a711c00a,start
X-Google-Attributes: gid11318c,public
From: sawyer@husc.harvard.edu (Charles Sawyer)
Subject: Template Instantiation using g++
Date: 1995/10/22
Message-ID: <199510230233.WAA23846@course1.harvard.edu>
X-Deja-AN: 117941586
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.help