   A static function pointer in a class
  I have the following code:class ImageScaler {static void InitialScale ();static void (*pInitialScale)();};voidImageScaler::InitialScale (){ImageScaler:InitialScale();}But I get the following errors for the last line:unresolved external symbol "private: static void (__cdecl* ImageScaler:InitialScale)(void)" (?pInitialScale@ImageScaler@@0P6AXXZA)Debug/V0P01.exe : fatal error LNK1120: 1 unresolved externalsWhy the compiler looks for a body of a function of the pointer to function member? 
  No, it's probably just looking for the instantiation, just like with any other static variable.In your cpp file, outside of any functions, add: void  (*ImageScaler::pInitialScale)(void);EDIT: Source tagged for smiley removal    [edited by - Sandman on February 4, 2004 7:39:14 AM];quote:Original post by Sandman  No, it''s probably just looking for the instantiation, just like with any other static variable.In your cpp file, outside of any functions, add: void  (*ImageScaler::pInitialScale)(void);EDIT: Source tagged for smiley removal    [edited by - Sandman on February 4, 2004 7:39:14 AM]Now it works, but why did it need that?I have a static DWORD member of a class and it doesnt require it to be instantiation?;quote:Original post by The C modest god  Now it works, but why did it need that?I have a static DWORD member of a class and it doesnt require it to be instantiation?It should do... all globals and static members need instantiating.It may just be that you haven''t tried using it, so the linker hasn''t spotted it yet.;  I''d already answered this in your other thread. This is sort of like cross posting. Glad you''ve got your answer but you didn''t respond to anything I posted which was getting you in the right direction. ;  Now the last thing I need to do is to use the static function pointer to point into a static function of a class, would that work? ;  No, for that you need to use Boost''s Function library. A class member pointer only points to a member of a particular class instance, and a static class doesn''t have an instance. ;quote:Original post by antareus  No, for that you need to use Boost''s Function library. A class member pointer only points to a member of a particular class instance, and a static class doesn''t have an instance.   No, he can point it to a static member function without any problems at all. If he tried to point it at a non-static member, then he might have problems, which could be solved either by rewriting the pointer definition (can''t remember the syntax off the top of my head) or by using a library like the Boost one you mention.