Bonjour,
Je programme sous OSX en mode éditeur de texte/terminal/makefile et je souhaiterais utiliser la SFML.
J'ai donc téléchargé les sources de la version 2.0, lancé
cmake, puis exécuté
make et
make install.
Jusque là pas de problème, c'est la démarche habituelle.
J'ai voulu tester le résultat en essayant de compiler le fichier suivant :
#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;
}
compilé avec ce makefile :
LIB = -lsfml-graphics -lsfml-window -lsfml-system
ALL:
g++ sfml_test.cpp -o test $(LIB)
clean:
rm -rf *.o
Et c'est là que les ennuis commencent, voilà le résultat du terminal :
g++ sfml_test.cpp -o test -lsfml-graphics -lsfml-window -lsfml-system
ld: warning: in /usr/lib/libsfml-graphics.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /usr/lib/libsfml-window.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /usr/lib/libsfml-system.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
_main in ccfDIkKr.o
"vtable for sf::CircleShape", referenced from:
sf::CircleShape::~CircleShape()in ccfDIkKr.o
sf::CircleShape::~CircleShape()in ccfDIkKr.o
"sf::Window::isOpen() const", referenced from:
_main in ccfDIkKr.o
"sf::RenderStates::Default", referenced from:
_main in ccfDIkKr.o
"sf::Color::Green", referenced from:
_main in ccfDIkKr.o
"sf::String::String(char const*, std::locale const&)", referenced from:
_main in ccfDIkKr.o
"sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)", referenced from:
_main in ccfDIkKr.o
"sf::Shape::~Shape()", referenced from:
sf::CircleShape::~CircleShape()in ccfDIkKr.o
"sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)", referenced from:
_main in ccfDIkKr.o
"sf::Window::pollEvent(sf::Event&)", referenced from:
_main in ccfDIkKr.o
"sf::RenderTarget::clear(sf::Color const&)", referenced from:
_main in ccfDIkKr.o
"sf::RenderWindow::~RenderWindow()", referenced from:
_main in ccfDIkKr.o
_main in ccfDIkKr.o
"sf::Window::display()", referenced from:
_main in ccfDIkKr.o
"sf::Shape::setFillColor(sf::Color const&)", referenced from:
_main in ccfDIkKr.o
"sf::Window::close()", referenced from:
_main in ccfDIkKr.o
"sf::CircleShape::CircleShape(float, unsigned int)", referenced from:
_main in ccfDIkKr.o
"sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
_main in ccfDIkKr.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ALL] Error 1
Si je comprends bien, la compilation des bibliothèques ne s'est pas faite pour la bonne architecture (qui serait x86_64), mais je n'arrive pas à indiquer l'architecture pour laquelle compiler les bibliothèques. J'ai essayé en utilisant les frameworks, mais ça n'a rien donné de mieux
Voilà, donc is quelqu'un a déjà eu ce problème et/ou a une solution, je suis preneur !