Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - thursday1036pm

Pages: [1]
1
General / Compiling SFML 1.6 with Code::Blocks 10.05
« on: May 03, 2011, 04:06:55 pm »
I'm an idiot  :D the tutorial is perfect.  Thanks for the quick response!

2
General / Compiling SFML 1.6 with Code::Blocks 10.05
« on: May 03, 2011, 04:02:51 pm »
Oh I see, in the text.  In the screenshot its shown as -lsfml-system.  I assumed that was for linking statically, since that's what the text right before it was discussing, but I was probably mistaken.

3
General / Compiling SFML 1.6 with Code::Blocks 10.05
« on: May 03, 2011, 03:49:47 pm »
Hello, this is my first post here!  I was having difficulty statically linking the binary MinGW release using Code::Blocks.  I'm relatively new to both Code::Blocks and SFML, but I didn't see any explicit instructions on how to get this to work anywhere, so I figured I'd post what I had to do.  I might be crazy, and there's probably an easier way of doing this.

I assume the reason this problem exists is the version of MinGW gcc Code::Blocks 10.05 ships with is different from the version SFML 1.6 was compiled with.  So, in an attempt to recompile SFML with Code::Blocks 10.05, I tried following the instructions here (under "Compiling SFML" near the bottom), but ran into problems there too.

The specific problem I ran into was that the import library naming scheme changed in Code::Blocks at some point, and the SFML Code::Blocks CBP files expect the old naming scheme (specifically, for *.dll, SFML expects *.a, and Code::Blocks now creates *.dll.a).  Based on this, this can be fixed editing the CBP files in SFML-x.y\build\codeblocks.

The specific changes I made that got things working are shown below...

Code: [Select]
diff -Naur SFML-1.6-old/build/codeblocks/sfml-audio.cbp SFML-1.6-new/build/codeblocks/sfml-audio.cbp
--- SFML-1.6-old/build/codeblocks/sfml-audio.cbp Wed Jan 27 14:53:00 2010
+++ SFML-1.6-new/build/codeblocks/sfml-audio.cbp Tue May  3 08:35:40 2011
@@ -12,7 +12,6 @@
  <Option external_deps="..\..\lib\mingw\libsfml-system-d.a;" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
@@ -32,6 +31,7 @@
  <Add library="..\..\extlibs\libs-mingw\libopenal32.a" />
  <Add library="..\..\extlibs\libs-mingw\libsndfile.a" />
  <Add directory="..\..\extlibs" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-audio-d.a" />
  </Linker>
  </Target>
  <Target title="Release DLL_Win32">
@@ -40,7 +40,6 @@
  <Option external_deps="..\..\lib\mingw\libsfml-system.a;" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-O3" />
  <Add option="-Wall" />
@@ -59,6 +58,7 @@
  <Add library="..\..\extlibs\libs-mingw\libopenal32.a" />
  <Add library="..\..\extlibs\libs-mingw\libsndfile.a" />
  <Add directory="..\..\extlibs" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-audio.a" />
  </Linker>
  </Target>
  <Target title="Debug static_Win32">

Code: [Select]
diff -Naur SFML-1.6-old/build/codeblocks/sfml-graphics.cbp SFML-1.6-new/build/codeblocks/sfml-graphics.cbp
--- SFML-1.6-old/build/codeblocks/sfml-graphics.cbp Wed Jan 27 14:53:00 2010
+++ SFML-1.6-new/build/codeblocks/sfml-graphics.cbp Tue May  3 08:36:00 2011
@@ -11,7 +11,6 @@
  <Option object_output="..\..\Temp\sfml-graphics\Debug DLL_Win32" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
@@ -33,6 +32,7 @@
  <Add library="..\..\extlibs\libs-mingw\libfreetype.a" />
  <Add library="libopengl32.a" />
  <Add directory="..\..\extlibs" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-graphics-d.a" />
  </Linker>
  </Target>
  <Target title="Release DLL_Win32">
@@ -41,7 +41,6 @@
  <Option external_deps="..\..\lib\mingw\libsfml-window.a;..\lib\mingw\libsfml-system.a;" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-O3" />
  <Add option="-Wall" />
@@ -63,6 +62,7 @@
  <Add library="..\..\extlibs\libs-mingw\libfreetype.a" />
  <Add library="libopengl32.a" />
  <Add directory="..\..\extlibs" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-graphics.a" />
  </Linker>
  </Target>
  <Target title="Debug static_Win32">

Code: [Select]
diff -Naur SFML-1.6-old/build/codeblocks/sfml-network.cbp SFML-1.6-new/build/codeblocks/sfml-network.cbp
--- SFML-1.6-old/build/codeblocks/sfml-network.cbp Wed Jan 27 14:53:00 2010
+++ SFML-1.6-new/build/codeblocks/sfml-network.cbp Tue May  3 08:36:28 2011
@@ -11,7 +11,6 @@
  <Option object_output="..\..\Temp\sfml-network\Debug DLL_Win32" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
@@ -29,6 +28,7 @@
  <Linker>
  <Add library="ws2_32" />
  <Add directory="..\..\bin\static" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-network-d.a" />
  </Linker>
  </Target>
  <Target title="Release DLL_Win32">
@@ -36,7 +36,6 @@
  <Option object_output="..\..\Temp\sfml-network\Release DLL_Win32" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-O3" />
  <Add option="-Wall" />
@@ -53,6 +52,7 @@
  <Linker>
  <Add library="ws2_32" />
  <Add directory="..\..\bin\static" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-network.a" />
  </Linker>
  </Target>
  <Target title="Debug static_Win32">

Code: [Select]
diff -Naur SFML-1.6-old/build/codeblocks/sfml-system.cbp SFML-1.6-new/build/codeblocks/sfml-system.cbp
--- SFML-1.6-old/build/codeblocks/sfml-system.cbp Wed Jan 27 14:53:00 2010
+++ SFML-1.6-new/build/codeblocks/sfml-system.cbp Tue May  3 08:37:07 2011
@@ -11,7 +11,6 @@
  <Option object_output="..\..\Temp\sfml-system\Debug DLL_Win32" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
@@ -25,13 +24,15 @@
  <ResourceCompiler>
  <Add directory="..\..\src" />
  </ResourceCompiler>
+ <Linker>
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-system-d.a" />
+ </Linker>
  </Target>
  <Target title="Release DLL_Win32">
  <Option output="..\..\lib\mingw\sfml-system.dll" prefix_auto="1" extension_auto="1" />
  <Option object_output="..\..\Temp\sfml-system\Release DLL_Win32" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-O3" />
  <Add option="-Wall" />
@@ -44,6 +45,9 @@
  <ResourceCompiler>
  <Add directory="..\..\src" />
  </ResourceCompiler>
+ <Linker>
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-system.a" />
+ </Linker>
  </Target>
  <Target title="Debug static_Win32">
  <Option output="..\..\lib\mingw\libsfml-system-s-d.a" prefix_auto="1" extension_auto="1" />

Code: [Select]
diff -Naur SFML-1.6-old/build/codeblocks/sfml-window.cbp SFML-1.6-new/build/codeblocks/sfml-window.cbp
--- SFML-1.6-old/build/codeblocks/sfml-window.cbp Wed Jan 27 14:53:00 2010
+++ SFML-1.6-new/build/codeblocks/sfml-window.cbp Tue May  3 09:42:43 2011
@@ -12,7 +12,6 @@
  <Option external_deps="..\..\lib\mingw\libsfml-system-d.a;" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-Wall" />
  <Add option="-g" />
@@ -31,6 +30,7 @@
  <Add library="..\..\lib\mingw\libsfml-system-d.a" />
  <Add library="libopengl32.a" />
  <Add library="libwinmm.a" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-window-d.a" />
  </Linker>
  </Target>
  <Target title="Release DLL_Win32">
@@ -39,7 +39,6 @@
  <Option external_deps="..\..\lib\mingw\libsfml-system.a;" />
  <Option type="3" />
  <Option compiler="gcc" />
- <Option createStaticLib="1" />
  <Compiler>
  <Add option="-O3" />
  <Add option="-Wall" />
@@ -57,6 +56,7 @@
  <Add library="..\..\lib\mingw\libsfml-system.a" />
  <Add library="libopengl32.a" />
  <Add library="libwinmm.a" />
+ <Add option="-Wl,--out-implib=..\..\lib\mingw\libsfml-window.a" />
  </Linker>
  </Target>
  <Target title="Debug static_Win32">


After this, it compiles fine!  I hope that helps someone.

Also, in the tutorial listed earlier (here), it says to link to the static library to add "-lsfml-system" to the linker options.  I found I needed to add "-lsfml-system-s".  Am I missing something?

Pages: [1]