INTERNAL COMPILER ERROR Visual Studio 2017 with SFML

0

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

  INTERNET 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 help desk file for more information   C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Common7 \ IDE \ VC \ VCTargets \ Microsoft.CppCommon.targets (358,5): MSB6006 error: "CL.exe" was terminated with code 2 .

Does anyone know what I can do to fix it?

Edit: Here is the code that is generating an 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;
}
    
asked by anonymous 26.07.2017 / 17:42

1 answer

0

I downloaded Visual Studio 2015 and tried to run the code on it (all sfml tutorials are made with vs 2015), and it 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:

-Using Visual Studio 2015 to schedule, or

-Recompile the sfml libraries in Visual Studio 2017 (which I do not know how to do)

    
05.08.2017 / 18:39