First few lines of the code (rest is identical to
here):
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
sf::Clock Clock;
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
// Load a sprite to display
sf::Image Image;
// [...]
other linker options:
-lsfml-audio
-lsfml-graphics
-lsfml-system
defines:
SFML_DYNAMIC
Clock, RenderWindow and Image link fine, however VideoMode (and all Window things which are not included in the above part) don't:
obj\Debug\main.o||In function `main':|
[...]\FirstSFML\main.cpp|10|undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'|
[...]\FirstSFML\main.cpp|41|undefined reference to `_imp___ZN2sf6Window5CloseEv'|
[...]\FirstSFML\main.cpp|37|undefined reference to `_imp___ZN2sf6Window8GetEventERNS_5EventE'|
[...]\FirstSFML\main.cpp|54|undefined reference to `_imp___ZN2sf6Window7DisplayEv'|
[...]\FirstSFML\main.cpp|33|undefined reference to `_imp___ZNK2sf6Window8IsOpenedEv'|
||=== Build finished: 5 errors, 0 warnings ===|
Statically linking doesn't work either.
I also tried linking with only the Clock (as in
here) and linking works. If I link statically I can run the binary fine, if I try linking dynamically it aborts because of the missing dll.
My PATH includes "[...]\SFML-1.6\lib" and "[...]\SFML-1.6\extlibs" which are the directories where the dll's lie (I have double checked by navigating there). Both are also included in the linker search directories in the global compiler settings.
When moving the dll to another folder in PATH, the dynamically linked binary runs fine too.