Compiling applications in C ++ so that they can work on other computers

So, I have this very simple SDL application that I want to transfer to my friend without downloading a whole bunch of SDL packages.

How can i do this? I was told to use this line to compile: (note that I am using ubuntu linux as well as my friend, and that this application compiles and runs without the “-Wl, -Bstatic” options just fine.)

    g ++ test-sdl.cpp -o test-sdl -Wl, -Bstatic -lSDL_image -lSDL

But then I get this error:

    / usr / bin / ld: cannot find -lgcc_s  
    collect2: ld returned 1 exit status

why am i getting this error? How can I fix this? Do I even need to do it this way? Is there any other / simpler / alternative way?

Am I asking so much to save my friend from the hassle of downloading packages that he will probably never use?

Thanks.

+3
source share
2 answers

In the long run, it will be best to figure out how to build .debs, and then managing your friend’s system package can take care of installing all the necessary dependencies. If you want to distribute packages more widely, using your own platform packaging system, as planned, will allow you and your users a lot of headaches.

Take a look at the Ubuntu tutorial on packaging and pbuilder .

, ( Debian) Debian book yada .

+3

-B, ( , . man g++, , , ).

, , - , B.

: , . "-Wl, -Bstatic" "-".

, - ( -Wl).

+2

Source: https://habr.com/ru/post/1703003/


All Articles