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

Author Topic: I want to display this car image but I am getting an error  (Read 1030 times)

0 Members and 1 Guest are viewing this topic.

rajhansk

  • Newbie
  • *
  • Posts: 21
    • View Profile
I want to display this car image but I am getting an error
« 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;
}

« Last Edit: October 23, 2017, 07:54:35 pm by Laurent »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: I want to display this car image but I am getting an error
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: I want to display this car image but I am getting an error
« Reply #2 on: October 23, 2017, 06:51:15 pm »
Also it is not related to SFML Projects...