SFML community forums

Help => General => Topic started by: rajhansk on October 23, 2017, 04:38:54 pm

Title: I want to display this car image but I am getting an error
Post by: rajhansk on October 23, 2017, 04:38:54 pm
I am getting an error saying "error: ld returned 1 exit status"

#include <SFML/Graphics.hpp>
#include<iostream>
using namespace std;
int main()
{
    sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
   // sf::CircleShape shape(100.f);
  //  shape.setFillColor(sf::Color::Green);
    sf::Image image;
    image.create(640,480,sf::Color::Blue);
    sf::Texture texture;
    if(!texture.loadFromFile("car.png"))
        return EXIT_FAILURE;

    sf::Sprite sprite;
    sprite.setTexture(texture);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(sprite);
        window.display();
    }

    return 0;
}

Title: Re: I want to display this car image but I am getting an error
Post by: eXpl0it3r on October 23, 2017, 05:25:24 pm
How much time did you spend figuring out the problem on your own? Did you ever put the error message into Google?

The linking failed so check the linker error output.
Title: Re: I want to display this car image but I am getting an error
Post by: achpile on October 23, 2017, 06:51:15 pm
Also it is not related to SFML Projects...