Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML error on MacBook  (Read 1163 times)

0 Members and 2 Guests are viewing this topic.

AyhamAlkhatib

  • Newbie
  • *
  • Posts: 1
    • View Profile
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
'''
« Last Edit: September 16, 2023, 06:43:28 pm by AyhamAlkhatib »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML error on MacBook
« Reply #1 on: September 18, 2023, 01:19:02 pm »
ARM64 on macOS is supported from SFML 2.6 onwards, so make sure you grab the right package.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Thrasher

  • SFML Team
  • Jr. Member
  • *****
  • Posts: 57
    • View Profile
Re: SFML error on MacBook
« Reply #2 on: September 19, 2023, 01:35:20 am »
Homebrew will install SFML built for your current CPU architecture so I'm not sure how you could accidentally mix the two. So long as you use don't tell the compiler to target a different architecture, the compiler will also target your current CPU architecture.

 

anything