Hello everyboy. I'm new to game development, altough not in programming and I'm taking a college course on game development in which I can use SFML or SDL. I decided to go with SFML, but I have ran into some errors.
First of all, I tried to use pre-built SFML 2.1 for Codeblocks, but I got lots of linker errors, and, after doing some research I realized it was due to the fact I'm using MinGW 4.8.2 instead of 4.7.2. So, I manually built SFML 2.1 using Cmake as explained in the tutorial on the SFML site ( further reference here:
http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php). The compilation and installation was a complete sucess. The trouble I have is, after setting Code::Blocks as is detailed here:
http://www.sfml-dev.org/tutorials/2.1/start-cb.php I still got lots of linker errors. I did research on the web and I found a post :
http://en.sfml-dev.org/forums/index.php?topic=13881.0The post above, to summarize, says that you need to set the compiler like this:
Defines
GLEW_STATIC
SFML_STATIC
UNICODE
Libraries
sfml-audio-s
sfml-graphics-s
sfml-network-s
sfml-window-s
sfml-system-s
sndfile
openal32
jpeg
glew
freetype
ws2_32
gdi32
opengl32
winmm
I have tried, but I got the very same errors everytime, and to be honest I don't know what else to do.
That's why I decided to post my Build Log here, to see if you guys can help me.
Disclaimer: By the way, it's a MUST, for the course to link SFML statically, that's the reason I'm struggling to make the most basic example run -or at least compile-.
I really really appreciate any kind of help!
BUILD LOG:
g++.exe -Os -O3 -Wmain -pedantic-errors -Wfatal-errors -Wextra -Wall -DGLEW_STATIC -DSFML_STATIC -DUNICODE -IC:\MinGW\include -IC:\SFML-2.1-MinGW\include -c "C:\Users\Alonso\Desktop\C++ Games\Tic Tac Toe\test.cpp" -o "C:\Users\Alonso\Desktop\C++ Games\Tic Tac Toe\test.o"
g++.exe -LC:\MinGW\include -LC:\MinGW\lib -LC:\SFML-2.1-MinGW\lib -o "C:\Users\Alonso\Desktop\C++ Games\Tic Tac Toe\test.exe" "C:\Users\Alonso\Desktop\C++ Games\Tic Tac Toe\test.o" C:\SFML-2.1-MinGW\lib\libsfml-audio-s.a C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a C:\SFML-2.1-MinGW\lib\libsfml-network-s.a C:\SFML-2.1-MinGW\lib\libsfml-window-s.a C:\SFML-2.1-MinGW\lib\libsfml-system-s.a C:\SFML-2.1-MinGW\lib\libsndfile.a C:\SFML-2.1-MinGW\lib\libopenal32.a C:\SFML-2.1-MinGW\lib\libjpeg.a C:\SFML-2.1-MinGW\lib\libglew32.a C:\SFML-2.1-MinGW\lib\libfreetype.a
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderWindow.cpp.obj):RenderWindow.cpp:(.text+0x355): undefined reference to `glReadPixels'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xf8): undefined reference to `glClearColor'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x6f6): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x6fb): undefined reference to `glPopMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x705): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x70a): undefined reference to `glPopMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x714): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x719): undefined reference to `glPopMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x71e): undefined reference to `glPopClientAttrib'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x75b): undefined reference to `glDisable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x765): undefined reference to `glDisable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x76f): undefined reference to `glDisable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x779): undefined reference to `glDisable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x783): undefined reference to `glEnable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x78d): undefined reference to `glEnable'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x797): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x7a1): undefined reference to `glEnableClientState'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x7ab): undefined reference to `glEnableClientState'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x7b5): undefined reference to `glEnableClientState'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x7c4): undefined reference to `glPolygonMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x7e3): undefined reference to `glBlendFunc'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x801): undefined reference to `glLoadMatrixf'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x88d): undefined reference to `glPushClientAttrib'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x897): undefined reference to `glPushAttrib'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8a1): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8a6): undefined reference to `glPushMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8b0): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8b5): undefined reference to `glPushMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8bf): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x8c4): undefined reference to `glPushMatrix'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xa1a): undefined reference to `glViewport'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xa24): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xa3c): undefined reference to `glLoadMatrixf'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xa46): undefined reference to `glMatrixMode'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xb08): undefined reference to `glBlendFunc'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xb28): undefined reference to `glBlendFunc'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xb4b): undefined reference to `glBlendFunc'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xb6b): undefined reference to `glBlendFunc'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xcf5): undefined reference to `glVertexPointer'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xd0e): undefined reference to `glColorPointer'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xd27): undefined reference to `glTexCoordPointer'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xd3c): undefined reference to `glDrawArrays'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xd95): undefined reference to `glLoadMatrixf'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xdc0): undefined reference to `glLoadMatrixf'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x107): undefined reference to `glClear'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0x728): undefined reference to `glPopAttrib'
C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj):RenderTarget.cpp:(.text+0xe04): undefined reference to `glLoadMatrixf'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\SFML-2.1-MinGW\lib\libsfml-graphics-s.a(RenderTarget.cpp.obj): bad reloc address 0x0 in section `.pdata'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
47 error(s), 0 warning(s) (0 minute(s), 1 second(s))
NOTES: I use Code:Blocks 13.12, with the MinGW 4.8.2 got from the Nuwen Site (
http://nuwen.net/mingw.html) on Windows 7 Home Premium 64 bit.