Just a little addition, these guards can help you to run just fine (windows build)
void Starfield::drawStarField(sf::Texture& texture)
{
for (auto it = smallStars.begin(); it != smallStars.end(); ++it)
{
auto xCoord = it->getXPos();
auto yCoord = it->getYPos();
if ((xCoord > 0 && xCoord < 1280) && (yCoord > 0 && yCoord < 960))
texture.update(smallStarImage, it->getXPos(), it->getYPos());
}
for (auto it = mediumStars.begin(); it != mediumStars.end(); ++it)
{
auto xCoord = it->getXPos();
auto yCoord = it->getYPos();
if ((xCoord > 0 && xCoord < 1279) && (yCoord > 0 && yCoord < 959))
texture.update(mediumStarImage, it->getXPos(), it->getYPos());
}
for (auto it = largeStars.begin(); it != largeStars.end(); ++it)
{
auto xCoord = it->getXPos();
auto yCoord = it->getYPos();
if ((xCoord > 0 && xCoord < 1276) && (yCoord > 0 && yCoord < 956))
texture.update(largeStarImage, it->getXPos(), it->getYPos());
}
}