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

Author Topic: Compile SFML with Code::Blocks and MinGW  (Read 4469 times)

0 Members and 1 Guest are viewing this topic.

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Compile SFML with Code::Blocks and MinGW
« on: October 06, 2008, 02:58:58 am »
Hi.. I spent a lot of time to compile SFML SVN(1.4)
I use with MinGW and with VS9C++
I compiled and used successfully SFML in VS9++.
Now I need SFML in MinGW for CodeBlocks..
Compile of SFML compile successfully with about 44 general warnings
but now, when go to compile my program
I get strange error that I cant found in SFML site.
The same program go well with
 SFML SVN(1.4)VS9++ and with C::B+MinGW+SFML1.3
I cant build with C::B+MinGW+SFML(SVN1.4)
I tried with Debug and Release simply
 changing the 2 search directory in C::B.

error in Debug mode:
Code: [Select]
E:\E\P\SFML\src\SFML\Audio\Sound.cpp|40|undefined reference to `_imp__alGenSources'|"

error in Release mode:
Code: [Select]
E:\E\P\SFML\src\SFML\Audio\Sound.cpp:(.text+0xe)||undefined reference to `_imp__alSourcePlay'|"


In program where I don't use Audio I get:
Code: [Select]
E:\E\P\SFML\src\SFML\Graphics\FontLoader.cpp|91|undefined reference to `FT_Done_FreeType'|


Please help me, thanks.
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

SirJulio

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Compile SFML with Code::Blocks and MinGW
« Reply #1 on: October 06, 2008, 01:10:24 pm »
Hi,

when you recompile with GCC, you must add external dependencies either with the ar tools to create an all-inclusive library, or add all dependencies (freetype, sndfiles, openal, + system lib) when you compile your final project.

The GCC tutorial explains this :

Quote
Compiling SFML static libraries with MinGW requires an extra-step if you want to include the external libraries as well, Code::Blocks can't do it automatically. If you don't do it, you will have to explicitly link with the external libraries used by SFML in each of your programs.

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Compile SFML with Code::Blocks and MinGW
« Reply #2 on: October 06, 2008, 01:56:52 pm »
Hi, I just return here after found page that you report here now.
http://www.sfml-dev.org/tutorials/1.4/start-cb.php
but I have to say that that this page
1) Don't contain example of the possible errors (idem in forum) (Google don't' send me here)
2) Isn't exhaustive for a normal developer without experience in Linux commands.. I can go to download CYGWIN & binutils but after this I have to study how to setup & use these.
Reading on forum about some code problem in SFML 1.3 I intend from text that I can compile&use SVN version without particular difficulty.
3) I try to use alternative method suggested in tutorial by linking libs directly in my application.. ok.. quite easy.. compile ok.. but program crash at start with abnormal runtime error.

For who wants to try I write here libs that I add into my project link options:
Code: [Select]
-lfreetype
-lopenal32
-lsndfile
-lgdi32
-lopengl32
-lwinmm
-lws2_32


adding serach dir of
Code: [Select]
/extlibs/libs-mingw
mingw/lib


All this post is written only to help SFML community and small developers.
I'm love all about SFML and the great documentation into the site!
I'm only hate losing time on compiler problems.
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)

SirJulio

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Compile SFML with Code::Blocks and MinGW
« Reply #3 on: October 06, 2008, 02:11:30 pm »
Yeap,

compile process is very different between Visual and Codeblocks, IMHO Codeblocks is a little more power-user oriented (I don't say that one is better than the other).

For your runtime error, are you sure that you link correct SFML lib for your config (debug with debug, release with release).

fixus971

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • http://www.fixweb.it
Compile SFML with Code::Blocks and MinGW
« Reply #4 on: October 06, 2008, 04:51:47 pm »
I understand your right observation..
I checked all..
The same code compiled 1second later run well simply changing search directory from SFML SVN to 1.3 and leaving extra libs
This night I'll go to retry all.

I love Code::Blocks but when I drop in a strange error only VS Debug can save me.
^_^=>Il calcolatore è straordinariamente veloce, accurato e stupido. Gli uomini sono incredibilmente lenti, imprecisi e creativi. L'insieme dei due costituisce una forza incalcolabile. (Albert Einstein)