I've been struggling to get SFML set up using the statically linked libraries for the past couple of hours.
I'm using Code::Blocks, and at the moment I have it set up so that both the debug and release versions of the modules are linked under
Project -> Build options -> Linker settings. The include and lib directories are added under
Search directories and SFML_STATIC has been typed in
#defines.
I'm using the example code from the SFML tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#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;
}
|
The errors I'm getting are:
||=== Build: Debug in SFML (compiler: GNU GCC Compiler) ===|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderWindow.cpp.obj)||In function `ZNK2sf12RenderWindow7captureEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderWindow.cpp|92|undefined reference to `glReadPixels@28'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget5clearERKNS_5ColorE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|97|undefined reference to `glClearColor@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|98|undefined reference to `glClear@4'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget4drawEPKNS_6VertexEjNS_13PrimitiveTypeERKNS_12RenderStatesE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|267|undefined reference to `glVertexPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|268|undefined reference to `glColorPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|269|undefined reference to `glTexCoordPointer@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|278|undefined reference to `glDrawArrays@12'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget12pushGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|297|undefined reference to `glGetError@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|307|undefined reference to `glPushClientAttrib@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|308|undefined reference to `glPushAttrib@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|310|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|311|undefined reference to `glPushMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|312|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|313|undefined reference to `glPushMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|314|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|315|undefined reference to `glPushMatrix@0'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget11popGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|327|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|328|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|329|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|330|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|331|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|332|undefined reference to `glPopMatrix@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|334|undefined reference to `glPopClientAttrib@0'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|335|undefined reference to `glPopAttrib@0'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget13resetGLStatesEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|360|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|361|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|362|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|363|undefined reference to `glDisable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|364|undefined reference to `glEnable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|365|undefined reference to `glEnable@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|366|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|367|undefined reference to `glEnableClientState@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|368|undefined reference to `glEnableClientState@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|369|undefined reference to `glEnableClientState@4'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget16applyCurrentViewEv':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|405|undefined reference to `glViewport@16'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|408|undefined reference to `glMatrixMode@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|409|undefined reference to `glLoadMatrixf@4'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|412|undefined reference to `glMatrixMode@4'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget14applyBlendModeERKNS_9BlendModeE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|430|undefined reference to `glBlendFunc@8'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(RenderTarget.cpp.obj)||In function `ZN2sf12RenderTarget14applyTransformERKNS_9TransformE':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp|471|undefined reference to `glLoadMatrixf@4'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(GLCheck.cpp.obj)||In function `ZN2sf4priv12glCheckErrorEPKcj':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\GLCheck.cpp|40|undefined reference to `glGetError@0'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(Texture.cpp.obj)||In function `checkMaximumTextureSize':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|64|undefined reference to `glGetIntegerv@8'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(Texture.cpp.obj)||In function `ZN2sf7TextureD2Ev':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|110|undefined reference to `glDeleteTextures@8'|
..\..\..\..\SFML-2.3\lib\libsfml-graphics-s-d.a(Texture.cpp.obj)||In function `ZN2sf7Texture6createEjj':|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|151|undefined reference to `glGenTextures@8'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|176|undefined reference to `glBindTexture@8'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|177|undefined reference to `glTexImage2D@36'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|178|undefined reference to `glTexParameteri@12'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|179|undefined reference to `glTexParameteri@12'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|180|undefined reference to `glTexParameteri@12'|
D:\sfml-release\_Sources\SFML\src\SFML\Graphics\Texture.cpp|181|undefined reference to `glTexParameteri@12'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
It works fine when the modules are dynamically linked, but I don't want have to add the libraries to every project I may wish to create.
I'd appreciate if someone helped me with this, it's kinda frustrating.