This is my code
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window;
window.create(sf::VideoMode(400, 400), "Test!");
window.setFramerateLimit(4);
sf::Event event;
while(window.isOpen())
{
while(window.pollEvent(event));
{
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
default:
window.clear(sf::Color(134,0,0));
window.display();
}
}
}
window.close();
return 0;
}
If I run
g++ -o -v main.cpp -lsfml-graphics
and I get
/usr/bin/ld: /tmp/ccduJuDb.o: undefined reference to symbol '_ZN2sf6Window17setFramerateLimitEj'
/usr/lib/libsfml-window.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
But if I run
g++ -o main.cpp -lsfml-graphics
I get
this and my main.cpp file is deleted.
What am I doing wrong?
Oh, and I just try compiling in Code Blocks, I get a bunch of undefined reference errors.