1
General / Re: Installing SFML on Windows without an IDE
« on: July 22, 2015, 11:22:21 am »
Hmm, trying to help:
It seems you have problem installing SFML, quote: "I want to install SFML on Windows", to do so you should download the correct version of SFML libraries: http://www.sfml-dev.org/download/sfml/2.3.1/
If you've already installed the correct libraries, skip steps 1 and 2.
To Install SFML, you should download the latest SFML (many version, the steps below should help):
1) Knowing which version of gcc you're using:
As you can see, it will require that you know what version of gcc you're on. To determine that, in windows command prompt, type "gcc --version", this should output you what version of gcc you have. If it is an invalid command, you may want to install gcc (MinGW), plenty of tutorials out there. Make sure mingw's bin is inserted in the windows environmental variable pathing - this enables you to use gcc directly from command prompt. Or include the pathing everytime.
2) Download the correct distribution of SFML: http://www.sfml-dev.org/download.php
If gcc is working, the gcc version should be provided, and you can Download the correct 32bit/64bit SFML library. If not, go download mingw (gcc's distributor) and redo step 1.
After you've downloaded the library, extract it somewhere and then follow the guide
3) Example linux 2.3.1 guide: http://www.sfml-dev.org/tutorials/2.1/start-linux.php
Follow the lower half-page of instructions, the compilation guides; gcc is implemented in the same manor.
Make sure to link against the includes directories if you are using a non-standard paths: using -I as stated in the linux guides and the additional libs using -l(lower case L). Else add the pathing to your windows environmental pathing.
My Example:
Windows command line: compilation of object file and executable:
4) Now you should be able to execute a code like in the linux examples, my example of non-standard compilation from the command line:
Using code from the "Getting started" guides provided by SMFL's website and the commands below:
g++ -IC:\SFML\include -c main.cpp -o main.o
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics -lsfml-window -lsfml-system
The above was assuming your SFML folder was located in your c: drive.
And, that should produce an executable.
To execute, you may need to have three dependencies to be located where the executable is.
They can be found in the .\SFML\bin folder and will be DLL's; for the above code, use the DLL's without "-d".
Or link, statically by adding adding the "-s" behind every lib in the command line.
Example:
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -ljpeg -lgdi32 -lwinmm
If you are linking against the static libs, make sure to include their sub-dependencies!
"Starting from SFML 2.2, when static linking, you will have to link all of SFML's dependencies to your project as well", stated half way down the page in the C::B installers guide.
http://www.sfml-dev.org/tutorials/2.3/start-cb.php
It wouldn't be impossible to make a guide on installing MinGW and compiling with windows command line, but probably unnecessary; the steps/examples above, pretty much, hints the process.
Hopefully this can be of some help.
It seems you have problem installing SFML, quote: "I want to install SFML on Windows", to do so you should download the correct version of SFML libraries: http://www.sfml-dev.org/download/sfml/2.3.1/
If you've already installed the correct libraries, skip steps 1 and 2.
To Install SFML, you should download the latest SFML (many version, the steps below should help):
1) Knowing which version of gcc you're using:
As you can see, it will require that you know what version of gcc you're on. To determine that, in windows command prompt, type "gcc --version", this should output you what version of gcc you have. If it is an invalid command, you may want to install gcc (MinGW), plenty of tutorials out there. Make sure mingw's bin is inserted in the windows environmental variable pathing - this enables you to use gcc directly from command prompt. Or include the pathing everytime.
2) Download the correct distribution of SFML: http://www.sfml-dev.org/download.php
If gcc is working, the gcc version should be provided, and you can Download the correct 32bit/64bit SFML library. If not, go download mingw (gcc's distributor) and redo step 1.
After you've downloaded the library, extract it somewhere and then follow the guide
3) Example linux 2.3.1 guide: http://www.sfml-dev.org/tutorials/2.1/start-linux.php
Follow the lower half-page of instructions, the compilation guides; gcc is implemented in the same manor.
Make sure to link against the includes directories if you are using a non-standard paths: using -I as stated in the linux guides and the additional libs using -l(lower case L). Else add the pathing to your windows environmental pathing.
My Example:
Windows command line: compilation of object file and executable:
4) Now you should be able to execute a code like in the linux examples, my example of non-standard compilation from the command line:
Using code from the "Getting started" guides provided by SMFL's website and the commands below:
g++ -IC:\SFML\include -c main.cpp -o main.o
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics -lsfml-window -lsfml-system
The above was assuming your SFML folder was located in your c: drive.
And, that should produce an executable.
To execute, you may need to have three dependencies to be located where the executable is.
They can be found in the .\SFML\bin folder and will be DLL's; for the above code, use the DLL's without "-d".
Or link, statically by adding adding the "-s" behind every lib in the command line.
Example:
g++ -LC:\SFML\lib -o main.exe -o main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lfreetype -ljpeg -lgdi32 -lwinmm
If you are linking against the static libs, make sure to include their sub-dependencies!
"Starting from SFML 2.2, when static linking, you will have to link all of SFML's dependencies to your project as well", stated half way down the page in the C::B installers guide.
http://www.sfml-dev.org/tutorials/2.3/start-cb.php
It wouldn't be impossible to make a guide on installing MinGW and compiling with windows command line, but probably unnecessary; the steps/examples above, pretty much, hints the process.
Hopefully this can be of some help.