# Linking against a static library with Projucer and Xcode?

**URL:** <https://forum.juce.com/t/linking-against-a-static-library-with-projucer-and-xcode/55299>\
**Category:** General JUCE discussion\
**Created:** [March 9, 2023, 1:02am UTC](https://forum.juce.com/t/linking-against-a-static-library-with-projucer-and-xcode/55299 "2023-03-09T01:02:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsetlik](https://avatars.discourse-cdn.com/v4/letter/h/85f322/32.png) [@hsetlik](https://forum.juce.com/u/hsetlik)\
**Post date:** [March 9, 2023, 1:02am UTC](https://forum.juce.com/t/linking-against-a-static-library-with-projucer-and-xcode/55299/1 "2023-03-09T01:02:04Z")

</div>

I have a desktop JUCE app that needs to make use of [libzippp](https://github.com/ctabin/libzippp) on both macOS and Windows. I downloaded the library and ran the cmake commands to compile and install everything as per the readme.  
This project already uses [Keyzy](https://developer.keyzy.io/tutorial-add-keyzy-to-juce-project) as a static library so I assumed that libzippp could be added the same way, adding `../../libzippp/src` to the header search paths and `../../libzippp/build` to the extra library search paths for both debug and release configurations in the Xcode exporter.  
In “Extra Libraries to link” I’ve tried building with `libzippp`, `libzippp_static`, and `zippp_static` and the static library file is called `libzippp_static.a` (for Keyzy, I use the string `KeyzyClient` and the library file is called `libKeyzyClient.a`)  
In Xcode, the editor auto-completes functions and types from libzippp and shows quick help from the library when hovering, but when trying to build it fails with a “Library not found for -llibzippp\_static” error message.  
Since the header file and the static library file are both present, I assume this might be a linker issue? Is there something I need to add to the “Extra Linker flags” field to make it work? Any help or advice appreciated!

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [March 9, 2023, 7:21am UTC](https://forum.juce.com/t/linking-against-a-static-library-with-projucer-and-xcode/55299/2 "2023-03-09T07:21:06Z")

</div>

You’ll have to forgive me if this doesn’t work; the project I’ve been working on for three years started out with one part of it being a static library that was linked into the other part, before I made a JUCE module out of it and dumped that approach. That was awhile ago.

But checking my notes, what I used to have to do, in the Projucer Xcode Exporter:

In “Extra Linker Flags”:

`-L../../folderContainingTheLib`

This is a path to the directory containing the lib, relative to the main Xcode project (file that is generated by Projucer).

Then in “External Libraries to Link” section, you would put (example):

`MyLibrary`

(note that the library file is actually named `libMyLibrary.a`, but you leave off ‘lib’ and ‘a’). I don’t remember why, but that is what used to work for me.

So in your case, I guess that would be `zippp_static` .

Another caveat: my static library was created with a separate Projucer Static Library project… may not matter…

EDIT: here, I dug up an old link where I think I got some help. Good luck!

> [@Problems linking static library](https://forum.juce.com/t/problems-linking-static-library/27910):
>
> Hi all, I’m having an issue trying to link a static library in Juce. I’ve managed to get it working in core C++ (XCode) by adding the Accelerate, CoreAudio, and CoreAudioKit frameworks along with my lib in the build phases setting in XCode, then bringing the lib and it’s corresponding .h into the file explorer. I tried to repeat this process in Juce (and even tried doing the same process alone in XCode, knowing it won’t save) and I still get linker errors. I tried linking it using the extra c…

---

<div class="post-metadata">

**Author:** ![hsetlik](https://avatars.discourse-cdn.com/v4/letter/h/85f322/32.png) [@hsetlik](https://forum.juce.com/u/hsetlik)\
**Post date:** [March 9, 2023, 7:01pm UTC](https://forum.juce.com/t/linking-against-a-static-library-with-projucer-and-xcode/55299/3 "2023-03-09T19:01:35Z")

</div>

Thanks! I did need to use `zippp_static` and include the underlying zip library, but it does build correctly
