In general, there is a code
#include <SFML\Graphics.hpp> #include <string> namespace game { const sf::Vector2u WINDOW_SIZE(256,240); int scaleCoeff = 2; class ImageResource { public: ImageResource(std::string url); sf::Image image; sf::Texture texture; sf::Sprite sprite; }; ImageResource::ImageResource(std::string url) { this->image.loadFromFile(url); this->texture.loadFromImage(this->image); this->sprite.setTexture(this->texture); } ImageResource logo("logo.png"); } int main() { sf::RenderWindow app(sf::VideoMode(game::WINDOW_SIZE.x, game::WINDOW_SIZE.y), "!Curse"); app.setSize(sf::Vector2u(game::WINDOW_SIZE.x * game::scaleCoeff, game::WINDOW_SIZE.y * game::scaleCoeff)); while (app.isOpen()) { sf::Event ev; while (app.pollEvent(ev)) { if (ev.type == sf::Event::Closed) app.close(); } app.clear(); app.draw(game::logo.sprite); app.display(); } } The fact is that the compiler does not swear at anything, but when you start the program, it just falls. I found out that the problem is in the ImageResource class. I even did not use pointers as the program crashes instantly.
static order initialization fiasco. Make thelogolocal variable so that the initialization order does not depend on the weather on Mars. - Croessmah