Im fairly new to programming so forgive me if I missed something obvious.
Im trying to compile this program from the tutorial
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
This is the error I get when codeblocks compiles:
-------------- Build: Debug in hello (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -o bin\Debug\hello.exe obj\Debug\main.o -lsfml-graphics -lsfml-window -lsfml-system
obj\Debug\main.o: In function `main':
C:/Users/~/~/~/~/~/~/hello/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/Users/~/~/~/~/~/~/hello/main.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
collect2.exe: error: ld returned 1 exit status
What's strange to me is that it only gives me errors about sf::Window functions, which Im guessing is in lsfml-window.
Also, if I compile in command prompt with this:
g++ main.cpp -o hello -lsfml-graphics -lsfml-window -lsfml-system
Then I get no linking errors and I get a working .exe