Hi!
I am getting errors, and I can not find the problem.
main.cpp
#include <iostream>
#include <SFML/Graphics.hpp>
#include "GameManager.h"
using namespace std;
int main()
{
...
GameManager game;
game.Init();
game.Load();
while (window.isOpen())
{
...
window.clear();
game.Draw(window);
window.display();
}
return 0;
}
GameManager.cpp
#include "GameManager.h"
#include "Resource.h"
GameManager::GameManager(){};
GameManager::~GameManager(){};
phResource rmgr;
Textura textura = rmgr.sprite_add("Bairros.png");
sf::Sprite sprite(*textura);
...
void GameManager::Draw(sf::RenderWindow &window)
{
window.draw(sprite);
}
...
ObjectManager.cpp
#include "ObjectManager.h"
...
Resource.cpp
#include "Resource.h"
phResource::phResource(){}
phResource::~phResource(){}
Textura phResource::sprite_add(std::string p)
{
TextureKey key = TextureKey::FromFile(p);
return (mgr.Acquire(key));
}
void phResource::sprite_delete(TextureKey key)
{
mgr.Release(key);
}
GameManager.h
#ifndef GERAL_H
#define GERAL_H
#include <string>
#include <iostream>
#include <SFML/Graphics.hpp>
#define ScreenWidth 800
#define ScreenHeight 600
class GameManager
{
public:
GameManager();
~GameManager();
//Main functions
void Init();
void Load();
void Update(sf::Event event);
...
void Draw(sf::RenderWindow &window);
//Keyboard
...
};
#endif
ObjectManager.h
#ifndef OBJECTMANAGER_H
#define OBJECTMANAGER_H
#include <string>
#include <iostream>
#include <SFML/Graphics.hpp>
...
class Objeto
{
public:
...
};
#endif
Resource.h
#ifndef PH_RESOURCE_H
#define PH_RESOURCE_H
#include<Thor/Resources.hpp>
using thor::Resources::TextureKey;
typedef thor::ResourcePtr<sf::Texture> Textura;
class phResource
{
public:
thor::ResourceManager<sf::Texture> mgr;
phResource();
~phResource();
Textura sprite_add(std::string p);
void sprite_delete(TextureKey key);
};
#endif
The errors:
obj\Release\Resource.o:Resource.cpp|| undefined reference to `_imp___ZN4thor9Resources10TextureKey8FromFileERKSsRKN2sf4RectIiEES3_'|
obj\Release\Resource.o:Resource.cpp:(.text$_ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE4findERS4_[__ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE4findERS4_]+0x1f)||undefined reference to `_imp___ZN4thor9ResourcesltERKNS0_10TextureKeyES3_'|
obj\Release\Resource.o:Resource.cpp:(.text$_ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE10_M_insert_EPKSt18_Rb_tree_node_baseSJ_RKSA_[__ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE10_M_insert_EPKSt18_Rb_tree_node_baseSJ_RKSA_]+0x19d)||undefined reference to `_imp___ZN4thor9ResourcesltERKNS0_10TextureKeyES3_'|
obj\Release\Resource.o:Resource.cpp:(.text$_ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE16_M_insert_uniqueERKSA_[__ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE16_M_insert_uniqueERKSA_]+0x12)||undefined reference to `_imp___ZN4thor9ResourcesltERKNS0_10TextureKeyES3_'|
obj\Release\Resource.o:Resource.cpp:(.text$_ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE16_M_insert_uniqueERKSA_[__ZNSt8_Rb_treeIN4thor9Resources10TextureKeyESt4pairIKS2_NS0_6detail12ResourceSlotIN2sf7TextureEEEESt10_Select1stISA_ESt4lessIS2_ESaISA_EE16_M_insert_uniqueERKSA_]+0x55)||undefined reference to `_imp___ZN4thor9ResourcesltERKNS0_10TextureKeyES3_'|
obj\Release\Resource.o:Resource.cpp:(.text$_ZN4thor15ResourceManagerIN2sf7TextureENS_9Resources10TextureKeyEE11AddResourceERKS4_[__ZN4thor15ResourceManagerIN2sf7TextureENS_9Resources10TextureKeyEE11AddResourceERKS4_]+0x62)||undefined reference to `_imp___ZNK4thor9Resources10TextureKey4LoadEv'|
||=== Build finished: 6 errors, 0 warnings (0 minutes, 5 seconds) ===|
I am using: Windows 7, SFML 2.0, Code::Blocks (MinGW), Thor 1.1.
Thanks in advance.