1
General / 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
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;
}
#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;
}