# Linking in a static library

**URL:** <https://forum.juce.com/t/linking-in-a-static-library/20885>\
**Category:** Android\
**Created:** [February 8, 2017, 10:50pm UTC](https://forum.juce.com/t/linking-in-a-static-library/20885 "2017-02-08T22:50:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [February 8, 2017, 10:50pm UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/1 "2017-02-08T22:50:03Z")

</div>

Hi, new to Android dev so wondered if someone could help me out. I have a static library that I’m building and wanting to link into a main project. Am ok doing this with win, osx and iOs, but not really sure what the output of the static library build is under Android and how to go about including that into the main project…

Any pointers much appreciated!

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [February 9, 2017, 10:34am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/2 "2017-02-09T10:34:26Z")

</div>

We are currently working on supporting this use-case.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [February 9, 2017, 10:36am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/3 "2017-02-09T10:36:00Z")

</div>

good to know, thanks… Ping an update here when ready and I’ll be happy to test out… Cheers

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [February 9, 2017, 10:45am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/4 "2017-02-09T10:45:20Z")

</div>

Just a quick note: Building static libraries and linking to them in other JUCE projects can really be a lot of hit & miss for a variety of reasons (incompatible build flags, duplicate symbols (especially if both projects use JUCE), strange order of static initialisers, etc.). Consider creating your own JUCE module instead.

In any case, we will have a fix for building static libraries on Android.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [February 9, 2017, 10:46am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/5 "2017-02-09T10:46:17Z")

</div>

ah, I see… yes, that might be a good idea - thanks for the suggestion, I’ll look into that…

---

<div class="post-metadata">

**Author:** ![DrTarantism](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/drtarantism/32/815_2.png) [@DrTarantism](https://forum.juce.com/u/DrTarantism)\
**Post date:** [April 7, 2018, 9:28am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/6 "2018-04-07T09:28:46Z")

</div>

Any updates on support for static libraries? I’m getting duplicate symbol errors.

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 10, 2018, 8:19am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/7 "2018-04-10T08:19:33Z")

</div>

We are actively working on supporting this use-case better. For now, if you are sure that both libraries are using the exact same version of JUCE you can simply tell the linker to ignore duplicate symbols. We do this with ROLI’s Noise app for example and it doesn’t seem to cause any problems.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [April 10, 2018, 11:36am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/8 "2018-04-10T11:36:48Z")

</div>

Yep, all my Android builds have:

![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/2/2002fde5f084599a69303429666e626bd95a8a17.jpg)

---

<div class="post-metadata">

**Author:** ![adamstark](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamstark/32/122_2.png) [@adamstark](https://forum.juce.com/u/adamstark)\
**Post date:** [May 9, 2018, 5:48pm UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/9 "2018-05-09T17:48:32Z")

</div>

Hey guys, I was just wondering if there was a solution to the static library / duplicate symbol thing coming soon? Would be very helpful if there was.

Thanks!

Adam

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [May 10, 2018, 7:25am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/10 "2018-05-10T07:25:26Z")

</div>

Hi Adam,

One thing you can do already now, is to manually remove any JUCE modules from being built in the static library: i.e. just keep the includes that include the JUCE headers and your own code.

The missing JUCE symbols will then be resolved when you link your JUCE app.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [May 10, 2018, 10:48am UTC](https://forum.juce.com/t/linking-in-a-static-library/20885/11 "2018-05-10T10:48:07Z")

</div>

or just add the -z muldefs as detailed above - that should fix the problem… does it not for you?
