I'm using C++ with SFML libraries with VisualCode on Xubuntu.
I have a texture Manager class.
#ifndef TEXTUREMANAGER_HEADER
#define TEXTUREMANAGER_HEADER
#include <SFML/Graphics.hpp>
#include <map>
#include <string>
class TextureManager {
private:
std::map<std::string, sf::Texture> _textures;
public:
void loadTexture(std::string, std::string);
sf::Texture& getSpecificTexture(std::string);
TextureManager()
{
}
};
#endif
That I call in another one of my class functions:
void OpenEngine::loadTextures()
{
std::string text = "texture_brunette_girl";
std::string loc = "../sprites/brunette.png";
_texmgr.loadTexture(text, loc);
}
(_texmgr is just an initialized TextureManager object)
However I get this error message when I compile:
test.o: In function `OpenEngine::loadTextures()':
/dev/open-engined/./src/OpenEngine.cpp:32: undefined reference to `TextureManager::loadTexture(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status
I'm compiling with G++, here's my compile command
g++ -c -std=c++11 -Wall -g ./src/test.cpp
g++ test.o -o open-engine -lsfml-graphics -lsfml-window -lsfml-system
I'm not sure why it's complaining about the undefined reference when I'm clearly calling that function with the correct data type. Looking hasn't been much help.
Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire