mercredi 27 septembre 2017

Compile a static librery with standard library static

I'm trying to compile a static library (let's call it library.a). This library consumes resources of standard libraries. There is some way that the library can statically link a standard library.

I have proven something like:

g++ -c library -static-libstdc++ -o library.o
ar rcs library.o library.a

But if I do so there is no link to the standard libraries.

Then I have proved this way:

g++ library -static-stdlib -o library.o
ar rcs library.o library.a

But ask me to add a main function.

Is there any possibility of creating a static library by statically linking also standard libraries (std :: string, std :: vector, std :: cin, etc ...).

Thanks :)

Aucun commentaire:

Enregistrer un commentaire