Forum de la communauté SFML

Aide => Général => Discussion démarrée par: Flyer le Mai 05, 2016, 08:04:44 pm

Titre: Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Flyer le Mai 05, 2016, 08:04:44 pm
Bonsoir,

J'aimerai compiler mon programme (ClientTCP avec Winsock) en "Release" de manière statique, j'ai suivit les étapes du tutoriel suivant http://www.sfml-dev.org/tutorials/2.3/start-vc-fr.php (http://fr.sfml-dev.org//www.sfml-dev.org/tutorials/2.3/start-vc-fr.php) et effectuer de nombreuses recherche sur internet, sans sucée.

J'ai pourtant linker les différentes libs statique ainsi que leur dépendance dans l'ordre suivant :

winmm.lib
sfml-system-s.lib
opengl32.lib
gdi32.lib
sfml-window-s.lib
freetype.lib
jpeg.lib
sfml-graphics-s.lib

 J'utilise aussi la RuntimeLibrary : Multi-threaded (/MT) Pour lier les bibliothéques de windows

A la compilation j'ai les erreurs suivante :
1>------ Build started: Project: Client, Configuration: Release Win32 ------
1>  main.cpp
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ)
1>c:\users\mael\documents\visual studio 2015\Projects\Client\Release\Client.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

J'aimerai vraiment pouvoir éxécuter mon programme sur d'autre machine sans avoir a le recompiler, merci d'avance.
 
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Laurent le Mai 05, 2016, 09:43:26 pm
SFML_STATIC dans tes options préprocesseur.
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Flyer le Mai 07, 2016, 12:08:24 pm
1>------ Build started: Project: Client, Configuration: Release Win32 ------
1>sfml-system-s.lib(String.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(Window.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(VideoMode.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(WindowImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(VideoModeImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(JoystickManager.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(SensorManager.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(WglExtensions.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(Joystick.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(RenderWindow.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(Image.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(Transform.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(View.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(Shader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(GLLoader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(Color.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-system-s.lib(Err.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>sfml-system-s.lib(ThreadLocal.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in ClientTCP.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__strstr
1>sfml-window-s.lib(WglExtensions.cpp.obj) : error LNK2001: unresolved external symbol __imp__strncpy
1>sfml-graphics-s.lib(GLLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__strncpy
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__realloc
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__fread
1>MSVCRT.lib(_chandler4gs_.obj) : error LNK2001: unresolved external symbol __except_handler4_common
1>C:\Users\Mael\Documents\Visual Studio 2015\Projects\Client\Release\Client.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

Aprés modification et ajout de SFML_STATIC en "Release". Merci pour votre message.
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Laurent le Mai 07, 2016, 01:20:48 pm
Le message est assez clair : tu as changé une option qui rend ton programme incompatible avec les bibliothèques SFML. Il ne faut pas lier les libs standards statiquement.
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Flyer le Mai 07, 2016, 02:53:16 pm
Tu veut dire par la que je ne dois pas ajouter l'extension -s a la fin des librairie sfml ? Ce ne sont pas les librairies pourtant dites statiques ?  :)
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Laurent le Mai 07, 2016, 03:29:40 pm
Je parle des libs standards, pas de SFML. Tu as changé une option dans ton projet, le lien statique des libs standards n'est jamais sélectionné par défaut.
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Flyer le Mai 07, 2016, 05:12:31 pm
Merci beaucoup, comment linker les libs standards dans visual studio 2015 s'il vous plait car cela fais plus d'une semaine que j'essaye de rendre mon programme utilisable sur d'autre machine...
Titre: Re : Laisaion statique SFML 2.3.2 Visual Studio 2015
Posté par: Flyer le Mai 07, 2016, 05:13:27 pm
Les DLL manquantes sont celle de visual studio.. MSVCP140D, ucrtbased etc..