> Can you post a minimal example? An example of which bit? The only one I've made up so far is attached. It shows a basic configuration that compiles when the template instantiations are in a header file that's included in several translation units - set CFLAGS to define SUPER and/or SUB to include a particular template instantiation. However, the example attached doesn't *quite* show what I had in practice - the only difference is that when I instantiate the templates in a header file in my real library, I don't have to do anything for the superclass - that all just seems to get generated. However, in the example attached, you don't get the superclass's template information unless you instantiate it separately. John G On Sat, Feb 27, 2010 at 4:24 PM, Brian Budge <brian.budge@xxxxxxxxx> wrote: > Hi John - > > I was surprised to see that compile :). You should be placing explicit > instantiations in a source file. I'm not sure why it didn't work before. > Can you post a minimal example? > > On Feb 27, 2010 5:19 AM, "John Graham" <johngavingraham@xxxxxxxxxxxxxx> > wrote: > > Okay, I seem to have gone and answered my own question! > > For some reason I couldn't do: > > > template class ost::TRTPSessionBase<ost::RTPBaseUDPIPv4Socket, > ost::RTPBaseUDPIPv4Socket, ost::AVPQueue>; > > > Because I'd get a few of the following back: > > > ccrtp/rtp.h: In member function 'ost::IPV4Host > ost::TRTPSessionBase<RTPDataChannel, RTCPChannel, > ServiceQueue>::getDataSender(ost::tpport_t*) const [with > RTPDataChannel = ost::RTPBaseUDPIPv4Socket, RTCPChannel = > ost::RTPBaseUDPIPv4Socket, ServiceQueue = ost::AVPQueue]': > rtpaudioport.cpp:24: instantiated from here > ccrtp/rtp.h:205: error: no matching function for call to > 'ost::RTPBaseUDPIPv4Socket::getSender(ost::tpport_t*&)' > ccrtp/channel.h:114: note: candidates are: ost::IPV4Host > ost::RTPBaseUDPIPv4Socket::getSender(ost::tpport_t&) const > > > But I can do: > > > inline template class ost::TRTPSessionBase<ost::RTPBaseUDPIPv4Socket, > ost::RTPBaseUDPIPv4Socket, ost::AVPQueue>; > > > And that seems to generate the necessary class information. > > Still seems like a bit of a mystery that this has to be specifically > generated though... is there a reason for that? > > Also, I have to turn off -pedantic-errors to compile that, as it's a > non-standard extension. Is there any way I can specify an > -fno-<something> option to turn this error off: > > error: ISO C++ forbids the use of 'inline' on explicit instantiations > > > Thanks again, > > John G >
Attachment:
temp-inst.tar.bz2
Description: BZip2 compressed data