Two Possibility(that comes mind):
Possibility #1:(Likely not it)
They're saying your image file may not be where you believe it to be.
Using IDE's you'll have to consider the idea that the executable is ran from inside the Debug folder or Release folder (people sometimes forget).
Ensure that your image file is there.
Otherwise, everyone is telling to you wrap your:
|
texture->loadFromFile(filename)
|
in an if statement - to ensure it properly loaded.
sf::Texture should return a bool if it failed to load from file.
http://sfml-dev.org/documentation/2.0/classsf_1_1Texture.php#a8e1b56eabfe33e2e0e1cb03712c7fcc7
http://sfml-dev.org/documentation/2.0/classsf_1_1Texture.php
---
Possibility #2:(This is probably it)
If that isn't it, you need to ensure that your texture object persists after leaving the function; persisting data would be, data from a higher scope, global, or "new" data.
SFML is responsible for all of its objects and will destroy them if you are to ever lose scope. It only binds to a pointer of Texture, so that may be the reason for having an empty image instead of your predicted image.