Symbols not found for architecture x86_64

I’m making a little breakout test game with SDL and C++ but I run into the following build error:

Undefined symbols for architecture x86_64:
"ResourceManager::PlayAudio(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool)", referenced from:
  Breakout::run() in Breakout.o
"Audio::Audio()", referenced from:
  ResourceManager::AddAudio(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ResourceManager.o
ld: symbol(s) not found for architecture x86_64

Here is what I have in my ResourceManager.h:

class ResourceManager {
static map<string, Texture*> Textures;
static map<string, Audio*> Audios;

static ResourceManager instance;

SDL_Renderer* CurrentRenderer;


public:
static ResourceManager* GetInstance();

void SetRenderer(SDL_Renderer* renderer);
void AddTexture(string TextureName, string file);
void RenderTexture(string TextureName, int x, int y);
void AddAudio(string AudioName, string file);
void PlayAudio(string AudioName, bool Loop);
};

And here is my ResourceManager.cpp:

map<string, Texture*> ResourceManager::Textures;
map<string, Audio*> ResourceManager::Audios;

ResourceManager ResourceManager::instance;

void ResourceManager::AddTexture(string TextureName, string file) {

Texture *texture = new Texture();

texture->load(CurrentRenderer, file.c_str());

Textures[TextureName] = texture;

}

void ResourceManager::RenderTexture(string TextureName, int x, int y) {
Textures[TextureName]->Render(x, y);
}

void ResourceManager::AddAudio(string AudioName, string file) {
Audio *audio = new Audio();

audio->LoadAudio(file);

Audios[AudioName] = audio;
}

void ResourceManager::SetRenderer(SDL_Renderer *renderer) { CurrentRenderer = renderer; }

ResourceManager* ResourceManager::GetInstance() { return &ResourceManager::instance; };

Possibly PlayAudioand AddAudio do not have 64-bit parameters? I’m on Mac OS X Yosemite with Xcode 6.


Source: c++

Leave a Reply