Forum de la communauté SFML
Général => Discussions générales => Discussion démarrée par: Blanchemain le Août 24, 2019, 10:39:11 am
-
Mon programme fonctionne sous Linux.
Lorsque je veux le compiler avec MXE, il compile mais j'obtiens une fin de non recevoir du linker :
.....................
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x4374f): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x43784): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x43793): undefined reference to `_imp___ZN2sf13TransformableD2Ev'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x437b6): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x437eb): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x437fa): undefined reference to `_imp___ZN2sf13TransformableD2Ev'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x4381d): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x43852): undefined reference to `_imp___ZTVN2sf6SpriteE'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x43861): undefined reference to `_imp___ZN2sf13TransformableD2Ev'
/tmp/ccg7Mp6N.o:oscSpace3D.cpp:(.text.startup+0x438de): undefined reference to `_imp___ZN2sf7TextureD1Ev'
collect2: error: ld returned 1 exit status
Makefile:13 : la recette pour la cible « oscSpace3D » a échouée
make: *** [oscSpace3D] Erreur 1
@debian:~/MXE/Compile/oscSpace3D$
J'utilise ceci dans mon make :
$(CC) -std=c++17 -O3 oscSpace3D.cpp -o oscSpace3D.exe -L/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib -lboost_filesystem-mt -lboost_system-mt -lpng -lwinmm -lfreetype -lgdi32 -lopengl32 -lglu32 -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -llo -DGL_GLEXT_PROTOTYPES -lpthread `pkg-config ` -lws2_32 -lwsock32 -liphlpapi
-
Si tu veux compiler en static faut définir SFML_STATIC
-
J'ai rajouté -DSFML_STATIC à ma ligne de compilation, mais j'ai toujours le même résultat
mais leur expression a un peu changé
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-window-s.a(JoystickImpl.cpp.obj):JoystickImpl.cpp:(.text+0x224c): undefined reference to `_imp__joyGetPosEx@8'
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-window-s.a(JoystickImpl.cpp.obj):JoystickImpl.cpp:(.text+0x2d4d): undefined reference to `_imp__joyGetDevCapsW@12'
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-window-s.a(JoystickImpl.cpp.obj):JoystickImpl.cpp:(.text+0x339f): undefined reference to `_imp__joyGetPosEx@8'
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-system-s.a(SleepImpl.cpp.obj):SleepImpl.cpp:(.text+0x24): undefined reference to `_imp__timeGetDevCaps@8'
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-system-s.a(SleepImpl.cpp.obj):SleepImpl.cpp:(.text+0x34): undefined reference to `_imp__timeBeginPeriod@4'
/home/dominique/MXE/mxe/usr/i686-w64-mingw32.static/lib/libsfml-system-s.a(SleepImpl.cpp.obj):SleepImpl.cpp:(.text+0x59): undefined reference to `_imp__timeEndPeriod@4'
collect2: error: ld returned 1 exit status
Makefile:13 : la recette pour la cible « oscSpace3D » a échouée
make: *** [oscSpace3D] Erreur 1
j'ai le même problème si j'utilise en test le programme d'exemple
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
-
Voici les includes de mon programme :
#include <winsock2.h>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
#include <atomic>
#include <fstream>
#include <stdio.h>
#include <stdexcept>
#include <unistd.h>
#include <dirent.h>
#include <sstream>
#include <locale>
#include <iomanip>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <boost/filesystem.hpp>
#include <GL/gl.h>
#include <GL/glu.h>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <lo/lo.h>
#include <lo/lo_cpp.h>
#include <signal.h>
#include "oscSpace3D.h"
using namespace std;
using namespace glm;
Il faut ajouter ceci avant lsfml-
-lpng -ljpeg -lfreetype -lwinmm -lOpenAL32 -lopengl32 -lgdi32 -lglu32 -lglew32s
et ne pas oublier
$(PKG_CONFIG) freetype2 sfml glew openal --libs --cflags ` -lws2_32 -lwsock32 -liphlpapi -lz
avec
PKG_CONFIG=$(CROSS)pkg-config
Et là, miracle ça fonctionne sous Wine.
Un paradoxe : ça plante au démarrage sous windows7 au moment de la création de la première fenêtre.:(
vocici la ligne complète
oscSpace3D: oscSpace3D.cpp
$(CC) -std=c++11 -O3 oscSpace3D.cpp -o oscSpace3D.exe -L/home/dominique/MXE/mxe/usr/x86_64-w64-mingw32.static/lib -lboost_filesystem-mt -lboost_system-mt -llo -lpng -ljpeg -lfreetype -lwinmm -lOpenAL32 -lopengl32 -lgdi32 -lglu32 -lglew32s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -DGL_GLEXT_PROTOTYPES -lpthread `$(PKG_CONFIG) freetype2 sfml glew openal --libs --cflags ` -lws2_32 -lwsock32 -liphlpapi -lz