问题
so I know that you can't depend a static library to another one but i was wondering if there is something that lets me combine them together. I am trying to setup a game engine project file in vstudio 2019 and i want to compile it as a static library. I need in some way to combine it with SDL 2 library because I want create some systems using SDL. Is there a way I can do that? Thanks for the help.
回答1:
When creating a library, you can specify "Additional dependencies" in the "Librarian" properties of the project. The dependency may be another library. Also set "Link Library Dependencies" to "Yes" so that the whole library is included.
回答2:
Sure you can have one static library depend on another. A static library is, roughly, a collection of independent compiled objects, with a "settling" of their provided and required symbol table. Those symbols that aren't found within the static library itself continue to be dependencies, which may well be provided by another static library.
Depending on your platform, there are tools for working with compiled libraries. On Unix-like operating systems, you would use the ar utility to combine static libraries ("archives") in various ways:
How to merge two "ar" static libraries into one?
On windows, there's the LIB.EXE
tool. See:
How to merge two windows vc static library into one
来源:https://stackoverflow.com/questions/61689155/how-to-combine-two-static-libraries