When trying to compile a c++ code, including the sfml api libraries, the following error occurs:
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 on the Visual C ++ Help menu, Or open the help desk 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" Was terminated with code 2.
I searched on the internet for a solution for this, but I couldn't solve it...
Heres the code with the error:
#include <SFML\Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(640, 480), "Bouncing Mushroom");
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 evnt;
while (window.pollEvent(evnt))
{
if (evnt.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();
}
I would like to know if there is a way to solve it, i dont know how to recompile the sfml libraries, so, someone tell me how to recompile the libraries if necessary...