Static Library path nightmare from hell

前端 未结 5 1529
天命终不由人
天命终不由人 2021-02-07 12:22

This is the point. I have a subproject (static library) created. The library compiles well. No errors. When I include this library inside a project and imports a header from tha

5条回答
  •  无人共我
    2021-02-07 13:04

    After downloading your sample project, I had it working in a few minutes by making the following changes.

    First, you need to add an entry for the MyProject target's Build Settings under Header Search Paths, so that the files such as HelloWorldLayer.h, which #import "cocos2d.h", know where to find that file.

    Under the Header Search Paths, I entered ../MyStaticLibrary/MyStaticLibrary/libs/** like shown in the image below:

    enter image description here

    That solved the problem of the inability of the preprocessor to find the necessary source files from the MyStaticLibrary, for the MyProject project, but after compiling, I got an error about missing symbols. I needed to add the built libMyStaticLibrary.a to the Link Binary With Libraries step like shown in the image below:

    enter image description here

    After that, the project compiles fine.

提交回复
热议问题