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

Author Topic: Static linking Linux  (Read 412 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 19
    • View Profile
Static linking Linux
« on: December 04, 2019, 05:59:51 pm »
I want to do a static link for a project that I'm working on and I wrote this example:
#include <SFML/Graphics.hpp>

int main()
    sf::RenderWindow AppWindow;
    sf::Event AppEvent;
    AppWindow.create(sf::VideoMode(800, 600), "app");
            if(AppEvent.type == sf::Event::Closed)
    return 0;
And then compile it with:
g++ main.cpp -static -o test -lsfml-graphics -lsfml-window -lsfml-system
After this message showed up:
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-system
collect2: error: ld returned 1 exit status
SFML is installed from the official Manjaro repo.


  • SFML Team
  • Hero Member
  • *****
  • Posts: 9573
    • View Profile
    • development blog
    • Email
Re: Static linking Linux
« Reply #1 on: December 05, 2019, 09:50:27 am »
The official Manjaro packages don't contain static libraries.
You'll have to rebuild SFML on your own.

Also static libraries have the suffix -s
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/