I have no idea what to do. I tried loading images (bmp), music (wav) or font (ttf) with LoadFromFile function, but the compiler always spits out similar error.
|In function `main':|
C:\_stuff\code blocks\projects\game1\main.cpp|14|undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)'|
C:\_stuff\code blocks\projects\game1\main.cpp|15|undefined reference to `sf::Font::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
This is how the source code looks:
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
sf::Font font;
sf::Texture hero_idle_texture;
hero_idle_texture.loadFromFile("hero_idle.bmp");
font.loadFromFile("arial.ttf");
return 0;
}
I put files both in the obj file and in the exe file directory. I tried reinstalling SFML, compiler and Code::Blocks several times, but it didn't work.
I'm programming in Code::Blocks, using SFML 2.3.2 and my OS is Windows 10 64 bit.
I also tried to recompile SFML using CMake but I got this problem:
http://stackoverflow.com/questions/39680283/cannot-generate-files-with-cmake-using-mingw-makefiles