SFML community forums

Help => General => Topic started by: tester on April 28, 2010, 11:58:24 am

Title: Compiling SFML
Post by: tester on April 28, 2010, 11:58:24 am
What do I have to do to compile SFML from source? There is no configure file for GCC. Does that mean I have to include all source files manually to the project?
Title: Compiling SFML
Post by: Laurent on April 28, 2010, 12:58:23 pm
Code: [Select]
make
make install
Title: Compiling SFML
Post by: tester on April 28, 2010, 02:34:03 pm
Yes, that's for Linux. But what if I want to compile with MinGW on the command line? The MinGW download only has the project files for Code::Blocks. And if I try to compile the Linux download with MinGW and MSYS, I get the following output:
Code: [Select]
make[1]: Entering directory `/home/User/SFML-1.5/src/SFML'
make[2]: Entering directory `/home/User/SFML-1.5/src/SFML/System'
g++ -o Clock.o -c Clock.cpp -W -Wall -pedantic -I../../../include -I../../ -O2 -
DNDEBUG -fPIC
Clock.cpp:1: warning: -fPIC ignored for target (all code is position independent
)
g++ -o Initializer.o -c Initializer.cpp -W -Wall -pedantic -I../../../include -I
../../ -O2 -DNDEBUG -fPIC
Initializer.cpp:1: warning: -fPIC ignored for target (all code is position indep
endent)
g++ -o Lock.o -c Lock.cpp -W -Wall -pedantic -I../../../include -I../../ -O2 -DN
DEBUG -fPIC
Lock.cpp:1: warning: -fPIC ignored for target (all code is position independent)

g++ -o Randomizer.o -c Randomizer.cpp -W -Wall -pedantic -I../../../include -I..
/../ -O2 -DNDEBUG -fPIC
Randomizer.cpp:1: warning: -fPIC ignored for target (all code is position indepe
ndent)
g++ -o Sleep.o -c Sleep.cpp -W -Wall -pedantic -I../../../include -I../../ -O2 -
DNDEBUG -fPIC
Sleep.cpp:1: warning: -fPIC ignored for target (all code is position independent
)
g++ -o Unicode.o -c Unicode.cpp -W -Wall -pedantic -I../../../include -I../../ -
O2 -DNDEBUG -fPIC
Unicode.cpp:1: warning: -fPIC ignored for target (all code is position independe
nt)
../../../include/SFML/System/Unicode.inl:32: warning: unused parameter 'Locale'
../../../include/SFML/System/Unicode.inl:68: warning: unused parameter 'Locale'
../../../include/SFML/System/Unicode.inl:68: warning: unused parameter 'Locale'
g++ -o Unix/Mutex.o -c Unix/Mutex.cpp -W -Wall -pedantic -I../../../include -I..
/../ -O2 -DNDEBUG -fPIC
Unix/Mutex.cpp:1: warning: -fPIC ignored for target (all code is position indepe
ndent)
In file included from Unix/Mutex.cpp:28:
../../../include/SFML/System/Unix/Mutex.hpp:32:21: pthread.h: No such file or di
rectory
In file included from Unix/Mutex.cpp:28:
../../../include/SFML/System/Unix/Mutex.hpp:76: error: `pthread_mutex_t' does no
t name a type
../../../include/SFML/System/Unix/Mutex.hpp:76: error: extra semicolon
Unix/Mutex.cpp: In constructor `sf::Mutex::Mutex()':
Unix/Mutex.cpp:38: error: `myMutex' was not declared in this scope
Unix/Mutex.cpp:38: error: `NULL' was not declared in this scope
Unix/Mutex.cpp:38: error: `pthread_mutex_init' was not declared in this scope
Unix/Mutex.cpp:38: warning: unused variable 'myMutex'
Unix/Mutex.cpp:38: warning: unused variable 'NULL'
Unix/Mutex.cpp:38: warning: unused variable 'pthread_mutex_init'
Unix/Mutex.cpp: In destructor `sf::Mutex::~Mutex()':
Unix/Mutex.cpp:47: error: `myMutex' was not declared in this scope
Unix/Mutex.cpp:47: error: `pthread_mutex_destroy' was not declared in this scope

Unix/Mutex.cpp:47: warning: unused variable 'myMutex'
Unix/Mutex.cpp:47: warning: unused variable 'pthread_mutex_destroy'
Unix/Mutex.cpp: In member function `void sf::Mutex::Lock()':
Unix/Mutex.cpp:56: error: `myMutex' was not declared in this scope
Unix/Mutex.cpp:56: error: `pthread_mutex_lock' was not declared in this scope
Unix/Mutex.cpp:56: warning: unused variable 'myMutex'
Unix/Mutex.cpp:56: warning: unused variable 'pthread_mutex_lock'
Unix/Mutex.cpp: In member function `void sf::Mutex::Unlock()':
Unix/Mutex.cpp:65: error: `myMutex' was not declared in this scope
Unix/Mutex.cpp:65: error: `pthread_mutex_unlock' was not declared in this scope
Unix/Mutex.cpp:65: warning: unused variable 'myMutex'
Unix/Mutex.cpp:65: warning: unused variable 'pthread_mutex_unlock'
make[2]: *** [Unix/Mutex.o] Error 1
make[2]: Leaving directory `/home/User/SFML-1.5/src/SFML/System'
make[1]: *** [sfml-system] Error 2
make[1]: Leaving directory `/home/User/SFML-1.5/src/SFML'
make: *** [sfml] Error 2


There should be a download for MinGW with a makefile to compile on the command line.
Title: Compiling SFML
Post by: gsaurus on April 28, 2010, 05:50:24 pm
Quote from: "tester"
But what if I want to compile with MinGW on the command line? The MinGW download only has the project files for Code::Blocks.

Don't you use Code::Blocks? There is a batch-build on the codeblocks build folder.
Title: Compiling SFML
Post by: Laurent on April 28, 2010, 09:14:56 pm
There are no MinGW makefiles for SFML.
Title: Compiling SFML
Post by: tester on April 28, 2010, 11:42:59 pm
Quote from: "gsaurus"
Don't you use Code::Blocks?

No. I compile directly under the command line.

Quote from: "Laurent"
There are no MinGW makefiles for SFML.

There should be. Even better, the makefile for Linux should be written in a way that it can compile both, the Linux and the Windows version with GCC.
Title: Compiling SFML
Post by: Laurent on April 29, 2010, 02:52:49 pm
Quote
Even better, the makefile for Linux should be written in a way that it can compile both, the Linux and the Windows version with GCC.

You can supply a patch :)