I'm sorry, this is probably the 10000th time someone posted about this issue and I already feel like a complete idiot about this, but I just couldn't get static linking of SFML libraries to work for me. Maybe I failed to follow the tutorials and documentations I've read about this, or maybe they were incomplete or not suitable for my case. I'd be very happy to have someone help me with this, please be patient with me
So, my OS is Windows 10 Pro 64 bit. I'd like to use the Eclipse (Eclipse Oxygen for C/C++ 64bit) IDE, because I'm familiar with it from using Java. I had already installed MinGW 6.3.0 (64 bit) for some C++ projects in Eclipse, which worked fine for me.
I downloaded SFML 2.4.2 (GCC 6.1.0 MinGW (DW2) - 32-bit) from
https://www.sfml-dev.org/download/sfml/2.4.2/, and used the link to download the suiting MinGW environment (MinGW Builds 6.1.0 (32-bit)).
I figured, I could just rename my MinGW installation folder (C:\MinGW was added to the path variable and recognized by eclipse) to the version I want to use, so I changed it to the fresh 6.1.0 version that way.
This worked for me, so I think I configured Eclipse properly to work with the required MinGW 6.1.0 (32bit).
I put the SFML folder in another place, let's say {SFML_DIR}.
I set up a new project, and set the properties to the following values:
Include paths (debug/release): {SFML_DIR}\include
Library search path (debug/release): {SFML_DIR}\lib
Libraries:
sfml-graphics-d
sfml-window-d
sfml-audio-d
sfml-network-d
sfml-system-d
(debug, without the '-d' for release).
This also worked fine for me.
But the same configurations (besides changing library names accordingly and defining SFML_STATIC) for static linking failed , I get the following error message:
17:10:59 **** Incremental Build of configuration Debug for project TemplateSFMLStatic ****
Info: Configuration "Debug" uses tool-chain "MinGW GCC" that is unsupported on this system, attempting to build anyway.
Info: Internal Builder is used for build
g++ "-LC:\\Projekte\\Libraries\\C++\\SFML-2.4.2-MinGW-32\\lib" -o TemplateSFMLStatic.exe "src\\TemplateSFML.o" -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-audio-s-d -lsfml-network-s-d -lsfml-system-s-d
C:\Projekte\Libraries\C++\SFML-2.4.2-MinGW-32\lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget5clearERKNS_5ColorE':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:106: undefined reference to `glClearColor@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:107: undefined reference to `glClear@4'
C:\Projekte\Libraries\C++\SFML-2.4.2-MinGW-32\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:276: undefined reference to `glVertexPointer@16'
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:277: undefined reference to `glColorPointer@16'
.
.
.
D:/sfml-release/_Sources/SFML/src/SFML/System/Win32/SleepImpl.cpp:44: undefined reference to `_imp__timeBeginPeriod@4'
D:/sfml-release/_Sources/SFML/src/SFML/System/Win32/SleepImpl.cpp:50: undefined reference to `_imp__timeEndPeriod@4'
collect2.exe: error: ld returned 1 exit status
17:11:00 Build Finished (took 355ms)The original error message is much longer, but it mainly consists of "undefined reference" errors, so I figured that it maybe wouldn't provide any more information. If it should be important, I can post the whole thing.
Could someone please help me understand why I get this error? Does it maybe have to do with other dependencies? I'm fine with using the dynamic linking for now, but I think I would want to use the static linking one day. But maybe, if this can't get resolved easily, it's better for me to stick to dynamic linking after all, what do you think?
Thank you in advance.