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;
}