Hello all,
i want to run SFML2 in Eclipse under Linux. I Just start a new Eclipse empty Makefile C++ Project.
All SFML includes and libs are installed in the standardpath.
Makefile
LIBS = -lsfml-graphics -lsfml-window -lsfml-system
all: hello
clean:
rm main.o hello
hello: main.o
g++ -g -o hello main.o
main.o:
g++ -c -g main.cpp
main.cpp
#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 klick Build all:
15:16:47 **** Incremental Build of configuration Default for project testSFML ****
make all
g++ -g -o hello main.o
main.o: In function `main':
/home/boo/dev/workspace/testSFML/main.cpp:5: undefined reference to `sf::String::String(char const*, std::locale const&)'
/home/boo/dev/workspace/testSFML/main.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
/home/boo/dev/workspace/testSFML/main.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
/home/boo/dev/workspace/testSFML/main.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
/home/boo/dev/workspace/testSFML/main.cpp:7: undefined reference to `sf::Color::Green'
/home/boo/dev/workspace/testSFML/main.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
/home/boo/dev/workspace/testSFML/main.cpp:15: undefined reference to `sf::Window::close()'
/home/boo/dev/workspace/testSFML/main.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
/home/boo/dev/workspace/testSFML/main.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
/home/boo/dev/workspace/testSFML/main.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
/home/boo/dev/workspace/testSFML/main.cpp:19: undefined reference to `sf::RenderStates::Default'
/home/boo/dev/workspace/testSFML/main.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/home/boo/dev/workspace/testSFML/main.cpp:20: undefined reference to `sf::Window::display()'
/home/boo/dev/workspace/testSFML/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
/home/boo/dev/workspace/testSFML/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
/home/boo/dev/workspace/testSFML/main.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
/home/boo/dev/workspace/testSFML/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
main.o: In function `sf::CircleShape::~CircleShape()':
/usr/local/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
/usr/local/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
/usr/local/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2: Fehler: ld gab 1 als Ende-Status zurück
make: *** [hello] Fehler 1
15:16:47 Build Finished (took 203ms)
Does anybody know what i do wrong ?