INTERNAL COMPILER ERROR Visual Studio 2017 with SFML

Asked

Viewed 274 times

0

I’m having a problem compiling a code in visual studio 2017 with SFML libraries, when I try to compile it gives the following error:

INTERNAL COMPILER ERROR in 'C: Program Files (x86) Microsoft Visual Studio 2017 Community VC Tools MSVC 14.10.25017 bin Hostx86 x86 CL.exe' Choose the Technical Support command from the Visual C++ Help menu, or open the Technical Support help file for more information C: Program Files (x86) Microsoft Visual Studio 2017 Community Common7 IDE VC Vctargets Microsoft.CppCommon.targets(358,5): error MSB6006: "CL.exe" ended with code 2.

Does anyone know what I can do to fix?

Edit: Here is the code that is generating error:

include <SFML\Graphics.hpp>

int main() {

    sf::RenderWindow window(sf::VideoMode(640, 480), "Bouncing Mushroom");

    //Criando Textura
    sf::Texture mushroomTexture;
    mushroomTexture.loadFromFile("mushroom.png");
    sf::Sprite mushroom(mushroomTexture);
    sf::Vector2u size = mushroomTexture.getSize;
    mushroom.setOrigin(size.x / 2, size.y / 2);
    sf::Vector2f increment(0.4f, 0.4f);

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

        if ((mushroom.getPosition().x + (size.x / 2) > window.getSize().x && increment.x > 0) || (mushroom.getPosition().x - (size.x / 2) < 0 && increment.x < 0))
        {
            // Reverse the direction on X axis.
            increment.x = -increment.x;
        }

        if ((mushroom.getPosition().y + (size.y / 2) > window.getSize().y && increment.y > 0) || (mushroom.getPosition().y - (size.y / 2) < 0 && increment.y < 0))
        {
            // Reverse the direction on Y axis.
            increment.y = -increment.y;
        }

        mushroom.setPosition(mushroom.getPosition() + increment);
        window.clear(sf::Color(16, 16, 16, 255)); // Dark gray.
        window.draw(mushroom); // Drawing our sprite.
        window.display();

    }

    return 0;
}

1 answer

0


I downloaded Visual Studio 2015 and tried to run the code on it(all sfml tutorials are done with vs 2015), and ran perfectly.

So what was happening was that there was no compatibility of that version of sfml with vs 2017, which leaves two solution options for my problem:

-Use Visual Studio 2015 to program, or

-Recompile sfml libraries in Visual Studio 2017 (something I don’t know how to do)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.