I'm relatively new to C++ etc, so I'm sure I'm doing something wrong or missing something, but I'm having trouble getting SFML 2.0 to work.
I'm using Code::Blocks 10.05 as my IDE, and my compiler is MinGW (the TDM-GCC distribution, version 4.6.1).
I have followed the installation tutorial, and have compiled both the Debug and Release versions (static) without errors. (There were some errors initially, as the TDM install does not include the files libgdi32.a, libopengl32.a, libwinmm.a or libws2_32.a - they were present in the SFML 1.6 zip though so I copied them over from there, and then everything worked fine.)
In CMake, I have set BUILD_SHARED_LIBS to FALSE, STATIC_STD_LIBS to TRUE, and have altered the two compiler exes to x86_64-w64-mingw32-g++.exe and x86_64-w64-mingw32-gcc.exe, to match what I use in code::blocks, as per the TDM instructions. I have done it with the default g++.exe and gcc.exe with identical results.
In Code::Blocks I started a new project, copied in the code from the 1.6 tutorial:
#include <SFML/System.hpp>
#include <iostream>
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}
return 0;
}
and I have set up search directories (compiler points to \include, linker points to \lib) in the global settings, and in the project build options I have set link options -lsfml-system-s-d for debug and -lsfml-system-s for release. I have no #defines set.
When I build for debug I get the following errors:
D:/Development/Projects/SFML Test/main.cpp:6: undefined reference to `__imp__ZN2sf5ClockC1Ev'
D:/Development/Projects/SFML Test/main.cpp:9: undefined reference to `__imp__ZNK2sf5Clock14GetElapsedTimeEv'
D:/Development/Projects/SFML Test/main.cpp:10: undefined reference to `__imp__ZN2sf5SleepEj'
D:/Development/Projects/SFML Test/main.cpp:7: undefined reference to `__imp__ZNK2sf5Clock14GetElapsedTimeEv'
and for release:
obj\Release\main.o:main.cpp:(.text.startup+0x19): undefined reference to `__imp__ZN2sf5ClockC1Ev'
obj\Release\main.o:main.cpp:(.text.startup+0x20): undefined reference to `__imp__ZNK2sf5Clock14GetElapsedTimeEv'
obj\Release\main.o:main.cpp:(.text.startup+0x2f): undefined reference to `__imp__ZN2sf5SleepEj'
I am stumped!