Takarakaka
Takarakaka

Reputation: 279

Compiling issue with SFML library in C++

I am making some project using SFML. I have downloaded library from their official site, using cmake I made VS10 project, compiled it and got all the libs and files I need. However, in my project I keep getting nonsense errors like

class "sf::SoundBuffer" has no member "LoadFromFile"

class "sf::Sound" has no member "SetBuffer"

even though I have checked in SoundBuffer header there is a function named LoadFromFile and in Sound there is a function called SetBuffer.

  SoundM::SoundM(void) 
  {
     buffer.LoadFromFile("ress/soundA.wav");
     collision.SetBuffer(buffer);
  }



   #ifndef SOUND_H
   #define SOUND_H

    enum Sounds {
PaddleCollision,
Losing
    };

     class SoundM {
     public:
SoundM(void);
void play(Sounds Sound);
    private:
sf::SoundBuffer buffer;
sf::Sound collision;
    };

    #endif 

What am I missing here?

Upvotes: 1

Views: 640

Answers (1)

danijar
danijar

Reputation: 34215

I assume that you are using the SFML version 2.0 RC. There was a name convention change and now, all function names start with a lowercase letter (camel case).

So you should try that.

buffer.loadFromFile("ress/soundA.wav");
collision.setBuffer(buffer);

Instead of that.

buffer.LoadFromFile("ress/soundA.wav");
collision.SetBuffer(buffer);

I hope that helps you!

Upvotes: 2

Related Questions