Thread: "illegal call of non-static member function"

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    97

    "illegal call of non-static member function"

    I created a class called WaveFile and in the public part of the class I have the following function:
    Code:
    int loadWaveFile(const char *filename, Sound *CurrentSound);
    Now from the Sound class I call that function like this:
    Code:
    WaveFile::loadWaveFile(name, this);
    What I get and I get a compiler error, "illegal call of non-static member function". What am I doing wrong?

    Thanks in advance.

  2. #2
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    You should call it using the dot operator instead.
    Code:
    WaveFile object;
    object.loadWaveFile();

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    97
    Thanks for the help, based on what you just told me I decided to make WaveFile a singleton.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. const correctness and static member variables
    By cunnus88 in forum C++ Programming
    Replies: 2
    Last Post: 02-21-2008, 05:26 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  5. Multiple types in lists, vectors or arrays.
    By megatron09 in forum C++ Programming
    Replies: 20
    Last Post: 08-31-2006, 01:54 PM