public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with template and global/static variable
@ 1999-12-12 17:11 Boris
  1999-12-31 22:24 ` Boris
  0 siblings, 1 reply; 2+ messages in thread
From: Boris @ 1999-12-12 17:11 UTC (permalink / raw)
  To: help-gcc

I just come from comp.lang.c++ where they told me I should ask here as it
must be a gcc linker problem. I hope you can help me.

I created a template that I can only use as a member of an object. If I try
to use a static or global variable of the template type I get a linking
error (gcc 2.7):

Clients.cpp:26: undefined reference to `Collector<int>::Collector(void)'

I have no idea why. It looks like that a constructor Collector(void) is
needed? The Collector template has a public constructor Collector(). Can't
this be used for global/static variables? Do I have to code another public
constructor for Collector: a Collector(void)?

Boris


^ permalink raw reply	[flat|nested] 2+ messages in thread

* problem with template and global/static variable
  1999-12-12 17:11 problem with template and global/static variable Boris
@ 1999-12-31 22:24 ` Boris
  0 siblings, 0 replies; 2+ messages in thread
From: Boris @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

I just come from comp.lang.c++ where they told me I should ask here as it
must be a gcc linker problem. I hope you can help me.

I created a template that I can only use as a member of an object. If I try
to use a static or global variable of the template type I get a linking
error (gcc 2.7):

Clients.cpp:26: undefined reference to `Collector<int>::Collector(void)'

I have no idea why. It looks like that a constructor Collector(void) is
needed? The Collector template has a public constructor Collector(). Can't
this be used for global/static variables? Do I have to code another public
constructor for Collector: a Collector(void)?

Boris


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-12 17:11 problem with template and global/static variable Boris
1999-12-31 22:24 ` Boris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).