Forum de la communauté SFML

Aide => Général => Discussion démarrée par: Mohb2000 le Août 24, 2019, 01:37:07 am

Titre: compiler sfml en ligne de commande
Posté par: Mohb2000 le Août 24, 2019, 01:37:07 am
Bonjour,
J'éssaie de compiler le programme suivant:

#include <SFML/Window.hpp>

int main(int argc, char const *argv[])
{
    sf::Window window(sf::VideoMode(1000, 1000), "hmdlh");
    return 0;
}


en utilisant les 2 commandes:
g++ -c main.cpp -o test.o -DSFML_STATIC -I C:\Users\Admin\SFML\include
g++ test.o -L C:\Users\Admin\SFML\lib -l sfml-window-s -l sfml-system-s -lopengl32 -lwinmm -lgdi32 -lfreetype -ljpeg

mais j'ai eu l'erreur:c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: cannot find -ljpeg
collect2.exe: error: ld returned 1 exit status


J'ai alors télécharger une bibliothèque appelée libjpeg de ce site http://gnuwin32.sourceforge.net/packages/jpeg.htm, j'ai copié le fichier jpeg.lib don mon répertoire lib puis j'ai relancé la 2ème commande. voilà ce qu'on m'affiche:

c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x3d): undefined reference to `_imp____acrt_iob_func'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x9a): undefined reference to `_imp____acrt_iob_func'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x113): undefined reference to `_imp____acrt_iob_func'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x193): undefined reference to `_imp____acrt_iob_func'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x1ee): undefined reference to `_imp____acrt_iob_func'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Admin\SFML\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.text+0x252): more undefined references to `_imp____acrt_iob_func' follow
collect2.exe: error: ld returned 1 exit status


Aidez-moi s'il vous plaît!!
Titre: Re: compiler sfml en ligne de commande
Posté par: G. le Août 24, 2019, 06:02:34 am
Pour tes erreurs je sais pas, mais ça fait quelques années que jpeg n'est plus une dépendance de SFML.
Titre: Re: compiler sfml en ligne de commande
Posté par: Laurent le Août 24, 2019, 01:21:49 pm
Toutes les dépendances de SFML sous Windows sont contenues dans les sources. Et en ce qui concerne la compilation, tout est indiqué dans les tutoriels de démarrage.