1
General / SFML error on MacBook
« on: September 16, 2023, 06:40:27 pm »
Hello all, this is my first question so hopefully I am doing it right. I am trying to run my SFML project with cpp on the terminal via make and it is showing me this error. Does anyone know how to solve this problem? I understand that the library is in X86 and my Mac is trying to run it with arm64 but it is failing.I installed SFML via home-brew. Does anyone know how to solve this problem.
'''
g++ --std=c++17 -Wall -Werror -pedantic -g -o sfml-app main.o -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system
ld: warning: ignoring file /usr/local/lib/libsfml-graphics.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-audio.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-system.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-window.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"sf::WindowBase::pollEvent(sf::Event&)", referenced from:
_main in main.o
"sf::RenderStates::Default", referenced from:
_main in main.o
"sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)", referenced from:
_main in main.o
"sf::RenderTarget::clear(sf::Color const&)", referenced from:
_main in main.o
"sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)", referenced from:
_main in main.o
"sf::RenderWindow::~RenderWindow()", referenced from:
_main in main.o
"sf::Transformable::setPosition(float, float)", referenced from:
_main in main.o
"sf::Transformable::move(float, float)", referenced from:
_main in main.o
"sf::Transformable::setScale(float, float)", referenced from:
_main in main.o
"sf::Transformable::~Transformable()", referenced from:
sf::Sprite::~Sprite() in main.o
"sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
_main in main.o
"sf::Sprite::Sprite(sf::Texture const&)", referenced from:
_main in main.o
"sf::String::String(char const*, std::__1::locale const&)", referenced from:
_main in main.o
"sf::Window::close()", referenced from:
_main in main.o
"sf::Window::display()", referenced from:
_main in main.o
"sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)", referenced from:
_main in main.o
"sf::Texture::Texture()", referenced from:
_main in main.o
"sf::Texture::~Texture()", referenced from:
_main in main.o
"sf::Keyboard::isKeyPressed(sf::Keyboard::Key)", referenced from:
_main in main.o
"sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
_main in main.o
"sf::WindowBase::isOpen() const", referenced from:
_main in main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sfml-app] Error 1
'''
'''
g++ --std=c++17 -Wall -Werror -pedantic -g -o sfml-app main.o -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system
ld: warning: ignoring file /usr/local/lib/libsfml-graphics.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-audio.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-system.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/lib/libsfml-window.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"sf::WindowBase::pollEvent(sf::Event&)", referenced from:
_main in main.o
"sf::RenderStates::Default", referenced from:
_main in main.o
"sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)", referenced from:
_main in main.o
"sf::RenderTarget::clear(sf::Color const&)", referenced from:
_main in main.o
"sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)", referenced from:
_main in main.o
"sf::RenderWindow::~RenderWindow()", referenced from:
_main in main.o
"sf::Transformable::setPosition(float, float)", referenced from:
_main in main.o
"sf::Transformable::move(float, float)", referenced from:
_main in main.o
"sf::Transformable::setScale(float, float)", referenced from:
_main in main.o
"sf::Transformable::~Transformable()", referenced from:
sf::Sprite::~Sprite() in main.o
"sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
_main in main.o
"sf::Sprite::Sprite(sf::Texture const&)", referenced from:
_main in main.o
"sf::String::String(char const*, std::__1::locale const&)", referenced from:
_main in main.o
"sf::Window::close()", referenced from:
_main in main.o
"sf::Window::display()", referenced from:
_main in main.o
"sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)", referenced from:
_main in main.o
"sf::Texture::Texture()", referenced from:
_main in main.o
"sf::Texture::~Texture()", referenced from:
_main in main.o
"sf::Keyboard::isKeyPressed(sf::Keyboard::Key)", referenced from:
_main in main.o
"sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
_main in main.o
"sf::WindowBase::isOpen() const", referenced from:
_main in main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sfml-app] Error 1
'''