Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Helik

Pages: [1]
1
Graphics / CodeLite with SFML
« on: August 26, 2017, 07:12:00 pm »
Hello there!

I use IDE CodeLite and wrote the following code:

Code: [Select]
#include <SFML/Graphics.hpp>
 using namespace sf;
int main()
{
    RenderWindow window(VideoMode(550, 200), "test");
   
    Texture t;
    t.loadFromFile("images\hero.png");
   
    Sprite s;
    s.setTexture(t);
    s.setPosition(50 , 25);
 
   while (window.isOpen())
   {
      Event event;
      while (window.pollEvent(event))
      {
         if (event.type == Event::Closed)
            window.close();
      }
 
      window.clear();
      window.draw(s);
      window.display();
   }
 
   return 0;
}

And when i click "Run" enter goes error:

Quote
F:/MyProject/SFML/First/main.cpp:8: undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)'


What's wrong?
I was looking for an explanation, but I couldn't find
The program was set up as stated here: https://en.sfml-dev.org/forums/index.php?topic=18820.0
When i use code, how here: https://www.sfml-dev.org/tutorials/2.4/start-cb.php it worked
If need something to add, I'll do  ;D


Pages: [1]
anything