Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10796
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: static member linker problem |
| Date | 2011-10-11 15:10 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <j71f8a$uog$1@online.de> (permalink) |
| References | <j71e8t$tul$1@online.de> <4e943d70$0$3064$7b1e8fa0@news.nbl.fi> |
On 2011-10-11 14:58:24 +0200, Juha Nieminen said: > Philipp Kraus <philipp.kraus@flashpixx.de> wrote: >> I can create a cpp file with the initialization, but is there a >> "header-only" solution to do the initialization without >> linker problems eg a design pattern or anything else? > > C++ does not support instantiating static members "inline" in the same > way as function definitions, except for templates (where the "inlineness" > is implicit). > > Either you have to use a compilation unit for the static member, or > you have to make the class templated. I think a own compilation unit is the best way, because there are only two classes with static members, that are not templated Thanks Phil
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
static member linker problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-11 14:53 +0200
Re: static member linker problem Juha Nieminen <nospam@thanks.invalid> - 2011-10-11 12:58 +0000
Re: static member linker problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-11 15:10 +0200
Re: static member linker problem Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-11 09:45 -0400
Re: static member linker problem "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-10-11 17:24 +0200
Re: static member linker problem "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-10-11 17:26 +0200
Re: static member linker problem Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-11 12:17 -0400
Re: static member linker problem Leigh Johnston <leigh@i42.co.uk> - 2011-10-11 17:29 +0100
csiph-web