#define SFML_STATIC
// this is 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;
}
this is the makefile:INCLUDE = -Iinclude
LIB = -Llib -lsfml-graphics-s -lfreetype -ljpeg -lsfml-window-s -lopengl32 -lgdi32 -lsfml-system-s -lwinmm
all: main.o
g++ $(LIB) main.o -o bin\\coe.exe
clean:
-del *.o
-del bin\\coe.exe
main.o: main.cpp
g++ $(INCLUDE) -c main.cpp
error:
g++ -Llib -lsfml-graphics-s -lfreetype -ljpeg -lsfml-window-s -lopengl32 -lgdi32
-lsfml-system-s -lwinmm main.o -o bin\\coe.exe
main.o:main.cpp:(.text+0x120): undefined reference to `sf::String::String(char c
onst*, std::locale const&)'
main.o:main.cpp:(.text+0x14e): undefined reference to `sf::VideoMode::VideoMode(
unsigned int, unsigned int, unsigned int)'
main.o:main.cpp:(.text+0x19a): undefined reference to `sf::RenderWindow::RenderW
indow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&
)'
main.o:main.cpp:(.text+0x1e2): undefined reference to `sf::CircleShape::CircleSh
ape(float, unsigned int)'
main.o:main.cpp:(.text+0x1f2): undefined reference to `sf::Color::Green'
main.o:main.cpp:(.text+0x203): undefined reference to `sf::Shape::setFillColor(s
f::Color const&)'
main.o:main.cpp:(.text+0x229): undefined reference to `sf::Window::close()'
main.o:main.cpp:(.text+0x249): undefined reference to `sf::Window::pollEvent(sf:
:Event&)'
main.o:main.cpp:(.text+0x279): undefined reference to `sf::Color::Color(unsigned
char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0x29c): undefined reference to `sf::RenderTarget::clear(s
f::Color const&)'
main.o:main.cpp:(.text+0x2b0): undefined reference to `sf::RenderStates::Default
'
main.o:main.cpp:(.text+0x2ca): undefined reference to `sf::RenderTarget::draw(sf
::Drawable const&, sf::RenderStates const&)'
main.o:main.cpp:(.text+0x2da): undefined reference to `sf::Window::display()'
main.o:main.cpp:(.text+0x2f1): undefined reference to `sf::Window::isOpen() cons
t'
main.o:main.cpp:(.text+0x331): undefined reference to `sf::RenderWindow::~Render
Window()'
main.o:main.cpp:(.text+0x38f): undefined reference to `sf::RenderWindow::~Render
Window()'
main.o:main.cpp:(.text+0x423): undefined reference to `sf::RenderWindow::~Render
Window()'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0xe): u
ndefined reference to `vtable for sf::CircleShape'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x18):
undefined reference to `vtable for sf::CircleShape'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x22):
undefined reference to `sf::Shape::~Shape()'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [all] Error 1
Press any key to continue . . .
EDIT: I'm using Windows Mingw32 GCC compiler