Resolving circular dependencies by linking the same library twice?

后端 未结 3 1350
花落未央
花落未央 2020-12-18 18:09

We have a code base broken up into static libraries. Unfortunately, the libraries have circular dependencies; e.g., libfoo.a depends on libbar.a a

3条回答
  •  被撕碎了的回忆
    2020-12-18 19:08

    Since it is a legacy application, I bet the structure of the libraries is inherited from some arrangement which probably does not matter any more, such as being used to build another product which you no longer do.

    Even if still structural reasons remain for the inherited library structure, almost certainly, it would still be acceptable to build one more library from the legacy arrangement. Just put all the modules from the 20 libraries into a new library, liballofthem.a. Then every single application is simply g++ -o myApp -lallofthem ...

提交回复
热议问题