-
SFML 2.0 works absolutely fine with Code::Blocks, but I'm having trouble setting up SFML 2.1. I have followed THIS (http://www.sfml-dev.org/tutorials/2.1/start-cb.php) guide perfectly many times, but when I try to compile the example project, it gives me a long list of undifined references to all sf:: commands. Example:
obj\Release\main.o:main.cpp:(.text.startup+0x125)||undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
I have followed the guide PERFECTLY, and tried compiling and re-compiling my project several times, but the problem persists.
Here is my build log:
-------------- Build: Release in Pooman of Poopooland! (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -std=c++11 -std=c++0x -std=c++98 -Wall -ansi -DSFML_STATIC -O2 -DSFML_STATIC -IC:\SFML-2.1\include -IC:\SFML-2.1\include -IC:\SDL-1.2.15\include -c "C:\Documents and Settings\Kain\Επιφάνεια εργασίας\Pooman\Pooman of Poopooland!\main.cpp" -o obj\Release\main.o
mingw32-g++.exe -LC:\SFML-2.1\lib -LC:\SFML-2.1\lib -LC:\SDL-1.2.15\lib -o "bin\Release\Pooman of Poopooland!.exe" obj\Release\main.o -s -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x2): undefined reference to `vtable for sf::CircleShape'
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x9): undefined reference to `vtable for sf::CircleShape'
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0xe): undefined reference to `sf::Shape::~Shape()'
obj\Release\main.o:main.cpp:(.text.startup+0xb5): undefined reference to `sf::String::String(char const*, std::locale const&)'
obj\Release\main.o:main.cpp:(.text.startup+0xec): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
obj\Release\main.o:main.cpp:(.text.startup+0x125): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x18e): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
obj\Release\main.o:main.cpp:(.text.startup+0x198): undefined reference to `sf::Color::Green'
obj\Release\main.o:main.cpp:(.text.startup+0x1ad): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x1c5): undefined reference to `sf::Window::isOpen() const'
obj\Release\main.o:main.cpp:(.text.startup+0x1ee): undefined reference to `sf::Window::pollEvent(sf::Event&)'
obj\Release\main.o:main.cpp:(.text.startup+0x212): undefined reference to `sf::Window::close()'
obj\Release\main.o:main.cpp:(.text.startup+0x23e): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
obj\Release\main.o:main.cpp:(.text.startup+0x255): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x25e): undefined reference to `sf::RenderStates::Default'
obj\Release\main.o:main.cpp:(.text.startup+0x272): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x280): undefined reference to `sf::Window::display()'
obj\Release\main.o:main.cpp:(.text.startup+0x2af): undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Release\main.o:main.cpp:(.text.startup+0x3bf): undefined reference to `sf::RenderWindow::~RenderWindow()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
19 errors, 0 warnings (0 minutes, 1 seconds)
What am I doing wrong?
-
-DSFML_STATIC -O2 -DSFML_STATIC
-LC:\SFML-2.1\lib -LC:\SFML-2.1\lib
-lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s
Why are all your SFML settings defined twice?
-
That's because when I copied the log I defined them both globally and in "Release", since that configuration works fine with SFML 2.0 for me so far.
I also tried defining them EXACTLY like in the guide, but it made no difference at all.
-
That's because when I copied the log I defined them both globally and in "Release"
You should never do that.
I also tried defining them EXACTLY like in the guide, but it made no difference at all.
Can you post the new compilation log anyway? Just to be sure ;)
-
You should never do that.
Noted. :)
Here's the new Log:
-------------- Build: Release in Pooman of Poopooland! (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -ansi -DSFML_STATIC -O2 -IC:\SFML-2.1\include -IC:\SDL-1.2.15\include -c "C:\Documents and Settings\Kain\Επιφάνεια εργασίας\Pooman\Pooman of Poopooland!\main.cpp" -o obj\Release\main.o
mingw32-g++.exe -LC:\SFML-2.1\lib -LC:\SDL-1.2.15\lib -o "bin\Release\Pooman of Poopooland!.exe" obj\Release\main.o -s -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x2): undefined reference to `vtable for sf::CircleShape'
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x9): undefined reference to `vtable for sf::CircleShape'
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0xe): undefined reference to `sf::Shape::~Shape()'
obj\Release\main.o:main.cpp:(.text.startup+0xb5): undefined reference to `sf::String::String(char const*, std::locale const&)'
obj\Release\main.o:main.cpp:(.text.startup+0xec): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
obj\Release\main.o:main.cpp:(.text.startup+0x125): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x18e): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
obj\Release\main.o:main.cpp:(.text.startup+0x198): undefined reference to `sf::Color::Green'
obj\Release\main.o:main.cpp:(.text.startup+0x1ad): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x1c5): undefined reference to `sf::Window::isOpen() const'
obj\Release\main.o:main.cpp:(.text.startup+0x1ee): undefined reference to `sf::Window::pollEvent(sf::Event&)'
obj\Release\main.o:main.cpp:(.text.startup+0x212): undefined reference to `sf::Window::close()'
obj\Release\main.o:main.cpp:(.text.startup+0x23e): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
obj\Release\main.o:main.cpp:(.text.startup+0x255): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x25e): undefined reference to `sf::RenderStates::Default'
obj\Release\main.o:main.cpp:(.text.startup+0x272): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
obj\Release\main.o:main.cpp:(.text.startup+0x280): undefined reference to `sf::Window::display()'
obj\Release\main.o:main.cpp:(.text.startup+0x2af): undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Release\main.o:main.cpp:(.text.startup+0x3bf): undefined reference to `sf::RenderWindow::~RenderWindow()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
19 errors, 0 warnings (0 minutes, 1 seconds)
-
Which package of SFML 2.1 did you download?
-
Following the guide, the "GCC 4.7 TDM (SJLJ) - 32 bits" one.
-
Ok.
What about your IDE? Code::Blocks 12.11 with default compiler?
-
Yes. "codeblocks-12.11mingw-setup.exe" freshly installed.
I have also tried "GCC 4.7 MinGW (DW2) - 32 bits" just in case, and it gives me other sorts of undefined references:
-------------- Build: Release in Pooman of Poopooland! (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -ansi -DSFML_STATIC -O2 -IC:\SFML-2.1\include -IC:\SDL-1.2.15\include -c "C:\Documents and Settings\Kain\Επιφάνεια εργασίας\Pooman\Pooman of Poopooland!\main.cpp" -o obj\Release\main.o
mingw32-g++.exe -LC:\SFML-2.1\lib -LC:\SDL-1.2.15\lib -o "bin\Release\Pooman of Poopooland!.exe" obj\Release\main.o -s -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s
C:\SFML-2.1\lib/libsfml-graphics-s.a(CircleShape.cpp.obj):CircleShape.cpp:(.text+0xdd): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(CircleShape.cpp.obj):CircleShape.cpp:(.eh_frame+0x63): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shape.cpp.obj):Shape.cpp:(.text+0x104): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shape.cpp.obj):Shape.cpp:(.text+0x194): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shape.cpp.obj):Shape.cpp:(.text+0x41a): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shape.cpp.obj):Shape.cpp:(.eh_frame+0x63): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x89): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0xd6): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x118): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x187): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x1eb): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x334): more undefined references to `_Unwind_Resume' follow
C:\SFML-2.1\lib/libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.eh_frame+0xbb): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(VertexArray.cpp.obj):VertexArray.cpp:(.text+0x122): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(VertexArray.cpp.obj):VertexArray.cpp:(.eh_frame+0x67): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x105): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x15b): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x5a3): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x889): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x9eb): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xb33): more undefined references to `_Unwind_Resume' follow
C:\SFML-2.1\lib/libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.eh_frame+0x5f): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(GLCheck.cpp.obj):GLCheck.cpp:(.text+0x47f): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(GLCheck.cpp.obj):GLCheck.cpp:(.eh_frame+0x6b): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0x7e5): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0xaf9): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0xb0e): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0xb23): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0xd73): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.text+0xec8): more undefined references to `_Unwind_Resume' follow
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.eh_frame+0x303): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(Shader.cpp.obj):Shader.cpp:(.eh_frame$_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_baseSB_RKS2_+0x13): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-graphics-s.a(ImageLoader.cpp.obj):ImageLoader.cpp:(.text+0x1027b): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(ImageLoader.cpp.obj):ImageLoader.cpp:(.text+0x10577): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-graphics-s.a(ImageLoader.cpp.obj):ImageLoader.cpp:(.eh_frame+0x1a73): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-window-s.a(VideoMode.cpp.obj):VideoMode.cpp:(.text+0x318): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(VideoMode.cpp.obj):VideoMode.cpp:(.eh_frame+0x103): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.text+0x91): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.text+0x103): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.text+0x2fa): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.text+0x52f): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.text+0x611): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(Window.cpp.obj):Window.cpp:(.eh_frame+0x73): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-window-s.a(GlResource.cpp.obj):GlResource.cpp:(.text+0x5c): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(GlResource.cpp.obj):GlResource.cpp:(.text+0x9f): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(GlResource.cpp.obj):GlResource.cpp:(.eh_frame+0x3f): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-window-s.a(VideoModeImpl.cpp.obj):VideoModeImpl.cpp:(.text+0x179): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(VideoModeImpl.cpp.obj):VideoModeImpl.cpp:(.eh_frame+0x53): undefined reference to `__gxx_personality_v0'
C:\SFML-2.1\lib/libsfml-window-s.a(GlContext.cpp.obj):GlContext.cpp:(.text+0x22d): undefined reference to `_Unwind_Resume'
C:\SFML-2.1\lib/libsfml-window-s.a(GlContext.cpp.obj):GlContext.cpp:(.text+0x23e): undefined reference to `_Unwind_Resume'
Process terminated with status 1 (0 minutes, 3 seconds)
50 errors, 0 warnings (0 minutes, 3 seconds)
-
I know it sounds crazy but what happens if you remove C:\SFML-2.1\lib from your linker settings? Post the output of the build if possible.
-
I know it sounds crazy but what happens if you remove C:\SFML-2.1\lib from your linker settings? Post the output of the build if possible.
This happens:
-------------- Build: Release in Pooman of Poopooland! (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -ansi -DSFML_STATIC -O2 -IC:\SFML-2.1\include -IC:\SDL-1.2.15\include -c "C:\Documents and Settings\Kain\Επιφάνεια εργασίας\Pooman\Pooman of Poopooland!\main.cpp" -o obj\Release\main.o
mingw32-g++.exe -LC:\SDL-1.2.15\lib -o "bin\Release\Pooman of Poopooland!.exe" obj\Release\main.o -s -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lsfml-graphics-s -lsfml-audio-s -lsfml-window-s -lsfml-system-s
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-graphics-s
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-audio-s
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-window-s
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lsfml-system-s
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
4 errors, 0 warnings (0 minutes, 0 seconds)
-
Can you upload the libsfml-system-s.a from C:\SFML-2.1\lib somewhere? I'll take a look at it.
-
Sure. Here you go:
libsfml-system-s.a (http://www.mediafire.com/?8096p2aif8dl1cw)
It would be weird if you found anything different, though. The whole folder is just what I downloaded from HERE (http://www.sfml-dev.org/download/sfml/2.1/).
EDIT: OK, this is extremely weird. I re-downloaded it, and now it works fine. Sorry for all of your time that I wasted, I really don't know what happened there. ;D
-
A little off topic, but did anyone else notice the name of the game seems to be Pooman of Poopland?
Nice. 8)