Hello everybody, new to SFML (using Linux ubuntu( feeling hopeless, tried everything i could think of nothing works:(
can't run codes, i have installed the engine as explained and seen the green circle , still nothing work
#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;
}
i try to run this code but get this error:""$ cd "/home/myname/sfml/" && g++ main.cpp -o main && "/home/tamir/sfml/"main
/usr/bin/ld: /tmp/ccK4qDnP.o: warning: relocation against `_ZTVN2sf11CircleShapeE' in read-only section `.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]'
/usr/bin/ld: /tmp/ccK4qDnP.o: in function `main':
main.cpp:(.text+0x7c): undefined reference to `sf::String::String(char const*, std::locale const&)'
/usr/bin/ld: main.cpp:(.text+0x9a): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
/usr/bin/ld: main.cpp:(.text+0xcd): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
/usr/bin/ld: main.cpp:(.text+0x109): undefined reference to `sf::CircleShape::CircleShape(float, unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x117): undefined reference to `sf::Color::Green'
/usr/bin/ld: main.cpp:(.text+0x122): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
/usr/bin/ld: main.cpp:(.text+0x140): undefined reference to `sf::Window::close()'
/usr/bin/ld: main.cpp:(.text+0x159): undefined reference to `sf::Window::pollEvent(sf::Event&)'
/usr/bin/ld: main.cpp:(.text+0x181): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: main.cpp:(.text+0x19e): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
/usr/bin/ld: main.cpp:(.text+0x1b7): undefined reference to `sf::RenderStates::Default'
/usr/bin/ld: main.cpp:(.text+0x1c2): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/usr/bin/ld: main.cpp:(.text+0x1d1): undefined reference to `sf::Window::display()'
/usr/bin/ld: main.cpp:(.text+0x1e0): undefined reference to `sf::Window::isOpen() const'
/usr/bin/ld: main.cpp:(.text+0x20b): undefined reference to `sf::RenderWindow::~RenderWindow()'
/usr/bin/ld: main.cpp:(.text+0x285): undefined reference to `sf::RenderWindow::~RenderWindow()'
/usr/bin/ld: /tmp/ccK4qDnP.o: in function `sf::CircleShape::~CircleShape()':
main.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x13): undefined reference to `vtable for sf::CircleShape'
/usr/bin/ld: main.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x21): undefined reference to `vtable for sf::CircleShape'
/usr/bin/ld: main.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x35): undefined reference to `sf::Shape::~Shape()'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status""