I'm learning to use SFML with the idea of making a small game, so far I've created a window and messed about with it's settings, and set up a draw loop and event handler.
The trouble started once I tried to add my first texture using the following code:
#include "SpaceNomad.ih"
void MainMenu(GameEngine &Engine)
{
sf::Texture texture;
if(!texture.loadFromFile("MenuBackGround.png"))
{
cout << "couldn't load background texture\n";
}
sf::Sprite *sprite = new sf::Sprite;
sprite->setTexture(texture);
Engine.AddEntity(sprite, 5);
}
which is outside of a different image literally the example code given on the SFML tutorial page.
When I try to compile this I get the following error:
||=== Build: Debug in space nomad (compiler: GNU GCC Compiler) ===|
obj\Debug\projects\st\take2\MainMenu.o||In function `Z8MainMenuR10GameEngine':|
D:\projects\st\take2\MainMenu.cpp|7|undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I have checked that all the sfml libraries are included in the build options(I'm using code::Blocks with GCC MinGW).
https://drive.google.com/file/d/0B4qzXcgqbLZtcHJWUy1vSUhpdVk/view?usp=sharing
Other topics I've seen deal with undefined references to functions people have made themselves, but here I'm using a library.
edit: I've just tried with the basic shape from the same libary:
sf::CircleShape *shape = new sf::CircleShape(50);
// set the shape color to green
shape->setFillColor(sf::Color(100, 250, 50));
Engine.AddEntity(shape, 5);
Which compiles and displays without a problem.