SFML community forums

Help => General => Topic started by: catalinnic on December 04, 2019, 05:59:51 pm

Title: Static linking Linux
Post by: catalinnic 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.
Title: Re: Static linking Linux
Post by: eXpl0it3r 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