-
Notifications
You must be signed in to change notification settings - Fork 805
Creating and Linking Against C Static Libraries
#Creating and Linking Against C++ Static Libraries
Follow the instructions below to have your Objective-C application project link against a C++ static library.
- In Visual Studio, right-click (1) on your solution and select Add (2) -> New Project... (3).

- Under Installed (1) -> Visual C++ (2) -> Windows (3) -> Universal (4), select Static Library (Universal Windows) (5).

- Name (1) your library project and click OK (2).

- When you're prompted to choose the platform version of your app, choose Windows 10 Anniversary Edition (10.0, Build 14393) (2) as the target version and Windows 10 (10.0, Build 10586) (1) as the minimum version.

Now that the library project has been added to your solution, you can edit it to add the functionality you need for your application. Once you're done, follow the steps below to link your Objective-C project against it.
- In Visual Studio, under your Objective-C project node that will be using the library, right-click on References (1) and select Add Reference... (2).

- Under Projects (1) -> Solution (2), check your library (3) and click OK (4).

- Right-click (1) on your Objective-C project and select Properties (2).

- Select Paths (3) under Configuration Properties (1) -> Clang (2).

- Add $(SolutionDir)\MyLib (1) to User Include Paths, where MyLib is the name of your library project. Add this path to all configurations of your project, by selecting each Configuration (2) and re-adding the same path. When you're done, click OK (3).

- For each source file that will use the library, right-click (1) on it, select Rename and change the file extension to .mm so that it is compiled as Objective-C++.

That's it! You should now be able to include your C++ library in your .mm files using the include directive with double quotes (1) and call its C++ functions (2).

Project
Using the bridge
- Getting Started
- Using vsimporter
- Using the SDK
- Building From Source
- Adding Objective C to an Existing Project
- UI Guidance
- Changing the SDK Version of a Project
- Debugging
- Debugging Stack Traces from Crash Dumps
- Supported Third Party Libraries
- Creating and Linking Against C++ Static Libraries
- Packaging
Samples and Tutorials
- Quick Start Tutorial
- Building a To-Do List App
- Building a Calculator App
- Mixing and Matching UIKit and XAML
- IOS Bridge Samples Repo
Contributing
Links