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

Author Topic: Undefined symbols for architecture x86_64?  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

ws6754

  • Newbie
  • *
  • Posts: 1
    • View Profile
Undefined symbols for architecture x86_64?
« on: April 16, 2023, 06:42:42 pm »
I'm just starting out with SFML so I tried running a program with SFML like in the tutorial and tried compiling it with g++ but it keeps saying
Undefined symbols for architecture x86_64:
  "sf::String::String(char const*, std::__1::locale const&)", referenced from:
      _main in main-caaa1c.o
  "sf::Window::close()", referenced from:
      _main in main-caaa1c.o
  "sf::Window::pollEvent(sf::Event&)", referenced from:
      _main in main-caaa1c.o
  "sf::Window::Window(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main-caaa1c.o
  "sf::Window::~Window()", referenced from:
      _main in main-caaa1c.o
  "sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
      _main in main-caaa1c.o
  "sf::Window::isOpen() const", referenced from:
      _main in main-caaa1c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
here's my code
#include <iostream>
#include <SFML/Window.hpp>
using namespace std;
int main() {
    sf::Window window(sf::VideoMode(800,600), "Window", sf::Style::Close);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    cout << endl;
    return 0;
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Undefined symbols for architecture x86_64?
« Reply #1 on: April 16, 2023, 11:56:44 pm »
Are you linking SFML?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/