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

Author Topic: Static linking Linux  (Read 1049 times)

0 Members and 1 Guest are viewing this topic.

catalinnic

  • 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");
    AppWindow.setVerticalSyncEnabled(true);
    while(AppWindow.isOpen())
    {
        while(AppWindow.pollEvent(AppEvent))
        {
            if(AppEvent.type == sf::Event::Closed)
                AppWindow.close();
        }
        AppWindow.clear();
        AppWindow.display();
    }
    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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • 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
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything