XCode 4.2 and Using a Static Library Causing Problems

后端 未结 2 873
长发绾君心
长发绾君心 2020-12-09 04:59

Like many others here SO, I am having issues using libraries in my XCode workspace. The idea is I have my main project (MyApp) and two libraries (lib1

2条回答
  •  盖世英雄少女心
    2020-12-09 05:46

    Here is how to create a static library and a project that use it.

    Step 1: Create a workspace: File > New > Workspace. This is not mandatory but it helps organize the projects.

    Step 2: Create a static library project: File > New > Project > Framework and Library > Cocoa Touch Static Library. Lets call it MyLib.

    Step 3: Create an Application Project: File > New > Project > Application> Empty Application, or any other application template. Lets call this project MyApp. If you placed the projects in different folders, you may have to use a different path.

    Now you have the following Projects in the workspace.

    Project structure

    Step 4: Configure the app so that it finds the .h files of the library. To do that, add the parent folder "../" and check the recursive checkbox.

    Header Search Path

    Step 5: Link the app to the library.

    enter image description here

提交回复
热议问题