Hi,
whenever I try to compile any of the sample codes, the same type of error occurs. Here's the build log:
-------------- Clean: Debug in SFML (compiler: SFML 2.4 Compiler)---------------
Cleaned "SFML - Debug"
-------------- Build: Debug in SFML (compiler: SFML 2.4 Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -DGLEW_STATIC -DSFML_STATIC -DUNICODE -g -DGLEW_STATIC -DSFML_STATIC -DUNICODE -DSFML_STATIC -IC:\CodeBlocks\SFML\include -IC:\CodeBlocks\SFML\include -IC:\CodeBlocks\SFML\include -c C:\Users\PP-9-12\Documents\Newfolder\cpp_projektai\SFML\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\CodeBlocks\SFML\lib -LC:\CodeBlocks\SFML\lib -LC:\CodeBlocks\SFML\lib -o bin\Debug\SFML.exe obj\Debug\main.o -lsfml-audio-s-d -lsfml-graphics-s-d -lsfml-network-s-d -lsfml-window-s-d -lsfml-system-s-d -lopenal32 -ljpeg -lfreetype -lws2_32 -lgdi32 -lopengl32 -lwinmm -ldxguid -lmingw32 -luser32 -lsfml-graphics-s-d -lfreetype -ljpeg -ldxguid -lsfml-window-s-d -lopengl32 -lgdi32 -lmingw32 -lsfml-system-s-d -lwinmm -luser32 -lsfml-audio-s-d -lsfml-network-s-d -lopenal32 -lws2_32 -lsfml-graphics-s -lfreetype -ljpeg -lsfml-window-s -lopengl32 -lgdi32 -lsfml-system-s -lwinmm
obj\Debug\main.o: In function `main':
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:5: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:7: undefined reference to `sf::Color::Green'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:15: undefined reference to `sf::Window::close()'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:19: undefined reference to `sf::RenderStates::Default'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:20: undefined reference to `sf::Window::display()'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/Users/PP-9-12/Documents/Newfolder/cpp_projektai/SFML/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Debug\main.o: In function `ZN2sf11CircleShapeD1Ev':
C:/CodeBlocks/SFML/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/CodeBlocks/SFML/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/CodeBlocks/SFML/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
20 error(s), 0 warning(s) (0 minute(s), 0 second(s))
And the code: #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;
}
SFML_STATIC is defined.
Linker/compiler dirs are defined correctly.
A few hours on Google yielded no results.
I use the MinGW version of SFML. Doesn't matter, whether it's 32/64 bit, either one produces the same errors.
My computer runs on Windows 7 SP1 64 bit.