From: Ulf M. <ulf...@ho...> - 2002-02-25 22:41:45
|
>From: Stephen M.Webb <ste...@cr...> >Reply-To: ste...@cr... >To: "Ulf Magnusson" <ulf...@ho...> >Subject: Re: [Mingw-users] Pointer to member vector problem... >Date: Mon, 25 Feb 2002 16:40:59 -0500 > >On December 31, 1969 07:00 pm, you wrote: > > When I try to define a vector with pointers to member functions I get > > a bunch of linker errors > > > > The errors can be reproduced by trying to compile this source: > > > > #include <vector> > > using std::vector; > > > > class A { > > public: > > void a(); > > }; > > > > class B { > > vector<void (A::*)()> fpVector; > > public: > > void add(void (A::*fp)()) { > > fpVector.push_back(fp); > > } > > }; > > > > int main() { > > B b; > > b.add(&A::a); > > } > > > >You have no definition for A::a(), just like the linker tells you. > >Try > > class A { > public: > void a() { } > }; > >instead. > > >-- >Stephen M. Webb Ops... I noticed it and changed it in my source file, but apperently I forgot to copy it over into my mail as well... just add a {} definition to a()... Ulfalizer _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |