I've got Code::Blocks running GCC, and for some time now, the system has been figured to work dynamically (notably the SFML files were copied into the /include directory of the given compiler).
However, I've encountered an error (I'm operating an earlier revision of SFML, 1.6, and the code presently relies on it, and I have a week to deploy a demonstration program so I can't risk dev environment change to another version) in attempting to link statically.
For some strange reason, my development environment doesn't require I include the SFML linker settings under project build settings for the dynamic system - it just works (I believe this is crucial point to make in order to solve the problem).
If I add in the following linker settings to make it static:
-lsfml-network-s
-lsfml-audio-s
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s
The code refuses to compile and throws up a series of errors, similar to this:
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| multiple definition of `sf::Sprite::Sprite()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000127.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| multiple definition of `sf::Sprite::SetImage(sf::Image const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000125.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::Image()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000075.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::~Image()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000080.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::LoadFromFile(std::string const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000060.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Color.o):Color.cpp|| multiple definition of `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000053.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp|| multiple definition of `sf::Drawable::~Drawable()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000162.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp|| multiple definition of `sf::Drawable::SetColor(sf::Color const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000151.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::Close()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000016.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::IsOpened() const'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000059.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::GetEvent(sf::Event&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000023.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::Display()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000019.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(VideoMode.o):VideoMode.cpp|| multiple definition of `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000045.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp:(.text$_ZN2sf6SpriteD0Ev[sf::Sprite::~Sprite()]+0x15d)||undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| more undefined references to `_Unwind_Resume' follow|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp:(.eh_frame+0x11)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| more undefined references to `_Unwind_Resume' follow|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(GraphicsContext.o):GraphicsContext.cpp:(.eh_frame+0x11)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|
Complaining of 'multiple definitions'.
Somehow, I suspect there's a conflict between the dynamic libraries and the static libraries, IE the dynamic library is already available by default (but I don't know how, as there's no configured settings for it: it's just added to the compiler /include folder etc etc) and the static tries to redefine the pre-existing definitions.
How on earth do I solve this problem and get it to link this specific project statically (without changing the entire dev environment and thus ruining the other dynamically linked projects)?