As they said, you need to define the texture in main code and pass it as a parameter in defCharset.
chars.h
#include <SFML/Graphics.hpp>
void defCharset(sf::Texture *gmChar, sf::Sprite *gmCharacther_semiIdle,sf::Sprite *gmCharacther_stage1, sf::Sprite *gmCharacther_stage2, std::string filename);
chars.cpp
#include "chars.h"
void defCharset(sf::Texture *gmChar, sf::Sprite *gmCharacther_semiIdle,sf::Sprite *gmCharacther_stage1,sf::Sprite *gmCharacther_stage2, std::string filename)
{
if (!gmChar->loadFromFile(filename)){
}
gmCharacther_semiIdle->setTexture(*gmChar);
gmCharacther_stage1->setTexture(*gmChar);
gmCharacther_stage2->setTexture(*gmChar);
}
main.cpp
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "chars.h"
const int AppHeight = 540;
const int AppWidth = 1020;
int main()
{
sf::RenderWindow Window(sf::VideoMode(AppWidth,AppHeight,32),"TESTE", sf::Style::Close | sf::Style::Titlebar);
//sf::Music backgroundMusic;
/*if(!backgroundMusic.openFromFile("Resource/FromHere.ogg")){
return EXIT_FAILURE;
}*/
////////////////////////////////////////////////////////////////////////
float x = 90;
float y = 40;
int mute = 0;
sf::Sprite gmChar_sm;
sf::Sprite gmChar_s1;
sf::Sprite gmChar_s2;
sf::Texture gmChar; // <-- create texture
defCharset(&gmChar, &gmChar_sm, &gmChar_s1, &gmChar_s2,"cb.bmp");
gmChar_sm.setPosition(x,y);
....