I'm trying to build a library with gcc (actually, MinGW) which depends on stdlibc++. I want to build mylib such that all of its dependencies get incorporated into it, so that anyone linking with mylib doesn't开发者_如何学运维 need to link against stdlibc++ (or, if they do, it's because their own code depends on stdlibc++). Can this be done?
Use ar -x
to extract the .o files you need from the original library (libstdc++, in your case). Include those .o files with your own when you link your library. Make sure the distribution terms of the original library are compatible with those of your own.
精彩评论