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

Author Topic: ERRORs with loadFromfile  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

sunsflower

  • Newbie
  • *
  • Posts: 2
    • View Profile
ERRORs with loadFromfile
« on: August 31, 2015, 02:06:08 pm »
the code is as follow:
when I build and run the project in vs2010, the consol flapped rapidly full of gibberish and my speaker started to beep... what's wrong with it?
I run it by step and found it stopped at the "loadfromfile" line.
#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Close);

        sf::Texture txr;
        if(!txr.loadFromFile("tank1.png"))
                return -1;
        sf::Sprite spr;
        spr.setTexture(txr);
       
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();

                window.draw(spr);

        window.display();
    }

    return 0;
}
 
« Last Edit: August 31, 2015, 02:15:31 pm by sunsflower »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: ERRORs with loadFromfile
« Reply #1 on: August 31, 2015, 02:11:51 pm »
You're probably mixing Debug with Release (or compiler versions/flags).
Make sure the configuration of SFML and your project is consistent.

And please use [code=cpp] [/code] in future posts.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

sunsflower

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: ERRORs with loadFromfile
« Reply #2 on: August 31, 2015, 02:42:48 pm »
You're probably mixing Debug with Release (or compiler versions/flags).
Make sure the configuration of SFML and your project is consistent.

And please use [code=cpp] [/code] in future posts.


problem solved, thanks! I'm so careless as to make such a mistake...

 

anything