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

Author Topic: I can´t install sfml  (Read 2339 times)

0 Members and 1 Guest are viewing this topic.

bernasveroli

  • Newbie
  • *
  • Posts: 2
    • View Profile
I can´t install sfml
« on: July 03, 2024, 01:37:17 am »
I really don´t understand what I´m doing wrong,
2 consecutive days trying to make things work but I can´t

-------------- Build: Debug in TESTESTESTES (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -DSFML_STATIC -g -IC:\SFML-2.6.1\include -c C:\Users\berna\Documents\TESTESTESTES\main.cpp -o obj\Debug\main.o
g++.exe -LC:\SFML-2.6.1\lib -o bin\Debug\TESTESTESTES.exe obj\Debug\main.o   -lmingw32 -luser32 -lgdi32 -lwinmm -ldxguid -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -lsfml-main-d
obj\Debug\main.o: In function `main':
C:/Users/berna/Documents/TESTESTESTES/main.cpp:6: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/berna/Documents/TESTESTESTES/main.cpp:6: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/Users/berna/Documents/TESTESTESTES/main.cpp:6: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/Users/berna/Documents/TESTESTESTES/main.cpp:9: undefined reference to `sf::Texture::Texture()'
C:/Users/berna/Documents/TESTESTESTES/main.cpp:10: undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:12: undefined reference to `sf::Sprite::Sprite(sf::Texture const&)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:15: undefined reference to `sf::WindowBase::isOpen() const&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:19: undefined reference to `sf::WindowBase::pollEvent(sf::Event&)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:23: undefined reference to `sf::Window::close()&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:27: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:27: undefined reference to `sf::RenderTarget::clear(sf::Color const&)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:30: undefined reference to `sf::RenderStates::Default&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:30: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:33: undefined reference to `sf::Window::display()&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:9: undefined reference to `sf::Texture::~Texture()&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:6: undefined reference to `sf::RenderWindow::~RenderWindow()&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:9: undefined reference to `sf::Texture::~Texture()&#39;
C:/Users/berna/Documents/TESTESTESTES/main.cpp:6: undefined reference to `sf::RenderWindow::~RenderWindow()&#39;
obj\Debug\main.o: In function `ZN2sf6SpriteD1Ev&#39;:
C:/SFML-2.6.1/include/SFML/Graphics/Sprite.hpp:47: undefined reference to `vtable for sf::Sprite&#39;
C:/SFML-2.6.1/include/SFML/Graphics/Sprite.hpp:47: undefined reference to `vtable for sf::Sprite&#39;
C:/SFML-2.6.1/include/SFML/Graphics/Sprite.hpp:47: undefined reference to `sf::Transformable::~Transformable()&#39;
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
22 error(s), 0 warning(s) (0 minute(s), 2 second(s))


This is the erro but I already read all the instructions for use sfml with Code Blocks
but first I also tried to develop in VS:code, which I prefer but I can´t make it work
I follow 3 different youtube tutorials and also tried to read foruns but I can´t figure out

Please help me
and sorry for my bad english

I really prefer vs code but I seems even complex

 
« Last Edit: July 03, 2024, 08:28:58 am by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: I can´t install sfml
« Reply #1 on: July 03, 2024, 08:35:58 am »
For VS Code, all you need is the CMake Extension and this CMake SFML Template.
If you don't want to do that, it will be harder.

---

From the screenshots, you're release configuration is wrong, as you didn't use the libraries with the -s suffix for static SFML libs.
Additionally, if you do use SFML statically, you'll also have to link all of SFML's dependencies, see the official tutorial: https://www.sfml-dev.org/tutorials/2.6/start-cb.php

Lastly, you have to use the same compiler that SFML was built with.
If you download an SFML package, you have to use the compiler that is linked on the download page.

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/