Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

InFerN0

C++ Class error

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am getting the message error C2352: ''F_Pak::F_PakClose'' : illegal call of non-static member function when i change it to static F_Pak::F_PakClose it produces errors saying error C2597: illegal reference to data member ''F_Pak::header'' in a static member function what am I doing wrong. I will post full source on request(its not long). Thanks

Share this post


Link to post
Share on other sites
Advertisement
The only thing i see is that F_Pak has to be a base class, and you have to be calling it from within a derived class''s member function.

-----------------------------------------------------------
PCMCIA - People Can't Memorize Computer Industry Acronyms
ISDN - It Still Does Nothing
APPLE - Arrogance Produces Profit-Losing Entity
SCSI - System Can't See It
DOS - Defunct Operating System
BASIC - Bill's Attempt to Seize Industry Control
IBM - I Blame Microsoft
DEC - Do Expect Cuts
CD-ROM - Consumer Device, Rendered Obsolete in Months
OS/2 - Obsolete Soon, Too.
WWW - World Wide Wait
MACINTOSH - Most Applications Crash; If Not, The Operating System Hangs

Share this post


Link to post
Share on other sites
Any time you reference a function like :: the it needs to be in the global scope, hence the "static" modifier. The reason you are getting the second error is that any static function can only access local or static data, it cannot access other members of the class unless they are declared "static" also.

-Liquid

Share this post


Link to post
Share on other sites
You''re probably calling a non-static member function. That''s illegal, because those accesses require the use of the this pointer, which isn''t present in a static function (since there''s no instance of the class).

So, static member functions can only access other static member functions and member data.

Erik

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!