I am trying SFML, but got some strange issue,
#include <SFML/Graphics.hpp>
#include <iostream>
int main() {
sf::RenderWindow window;
window.create(sf::VideoMode(1100, 600), "SFML - learning");
while (window.isOpen()) {
std::cout << "Inside the game loop.\n"; // issue is here
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
exit(EXIT_SUCCESS);
}
}
window.clear();
window.display();
}
return 0;
} '''
when I do compile/Link and go for output, nothing prints on my console.It runs successfully but on console should also print "Inside the game loop.", but it does nothing. Here is what I am doing (I am using mingw compiler)
g++ -IC:\SFML-2.5.1\include -c main.cpp -o out.o
g++ -LC:\SFML-2.5.1\lib .\out.o -o app.exe -lmingw32 -lsfml-graphics -lsfml-window -lsfml-system -lsfml-main -mwindows
-mwindows
means "don't open a console for my application". You might want to remove it in debug builds.