# Multiple Definition Error Code

**URL:** <https://forum.arduino.cc/t/multiple-definition-error-code/1437992>\
**Category:** Programming\
**Created:** [April 1, 2026, 1:26am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992 "2026-04-01T01:26:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ouijeweera](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ouijeweera/32/1128553_2.png) [@ouijeweera](https://forum.arduino.cc/u/ouijeweera)\
**Post date:** [April 1, 2026, 1:26am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/1 "2026-04-01T01:26:07Z")

</div>

I keep getting this error message when running this code:  
Error Message:

```arduino
C:\Users\Gavin(personal)\AppData\Local\arduino\sketches\9C999848CC5204E05830B48307B9C19F\libraries\Adafruit_APDS9960_Library\Adafruit_APDS9960.cpp.o (symbol from plugin): In function `pow(float, float)':
(.text+0x0): multiple definition of `pow(float, float)'
C:\Users\Gavin(personal)\AppData\Local\arduino\sketches\9C999848CC5204E05830B48307B9C19F\libraries\Adafruit_TCS34725\Adafruit_TCS34725.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1

Compilation error: exit status 1

```

The Code:

```arduino
#include "Adafruit_TCS34725.h"
#include "Adafruit_APDS9960.h"
void setup() {
}
void loop() {
}

```

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [April 1, 2026, 1:30am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/2 "2026-04-01T01:30:53Z")

</div>

Welcome

This is not an upload problem but a compile (verify) problem 😉 Hence your topic has been moved to a more suitable category of the forum.

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 1, 2026, 1:32am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/3 "2026-04-01T01:32:14Z")

</div>

~~For what board and core?~~

Never mind. Adafruit defined the function powf in both libraries. And didn't bother to make it static.

> <https://github.com/adafruit/Adafruit_APDS9960/issues/51>
>
> \*\*Problem\*\*
> Both Adafruit\_APDS9960.cpp and Adafruit\_TCS34725.cpp define their ow…n powf() function.
> As a result, using both libraries in the same project causes a compilation error.
> 
> \*\*Error log (PlatformIO, Arduino Uno R4 WiFi):\*\*
> .pio\\build\\uno\_r4\_wifi\\lib7ad\\libAdafruit\_TCS34725.a(Adafruit\_TCS34725.cpp.o): In function \`powf':
> Adafruit\_TCS34725.cpp:(.text.powf+0x0): multiple definition of \`powf'
> .pio\\build\\uno\_r4\_wifi\\libd24\\libAdafruit\_APDS9960\_Library.a(Adafruit\_APDS9960.cpp.o):Adafruit\_APDS9960.cpp:(.text.powf+0x0): first defined here

---

<div class="post-metadata">

**Author:** ![ouijeweera](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ouijeweera/32/1128553_2.png) [@ouijeweera](https://forum.arduino.cc/u/ouijeweera)\
**Post date:** [April 1, 2026, 1:37am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/4 "2026-04-01T01:37:12Z")

</div>

Is there any way to use both libraries for one code?

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 1, 2026, 1:39am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/5 "2026-04-01T01:39:14Z")

</div>

Yup. Edit the .cpp files named and make powf a static function in both.

The problem was raised in the repository 6 months ago and... crickets.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [April 1, 2026, 1:52am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/6 "2026-04-01T01:52:54Z")

</div>

Find the libraries in the _libraries_ sub directory of the sketchbook directory.

Open the .cpp file with a normal editor and modify the line  
`float powf(const float x, const float y) {`  
to  
`static float powf(const float x, const float y) {`

Note:  
You will loose those changes if you update or downgrade the library !!

@van_der_decken  
When you have time, what is the reason that the compiler complains about `pow` and not about `powf`?

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 1, 2026, 2:09am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/7 "2026-04-01T02:09:42Z")

</div>

> [@sterretje](#):
>
> When you have time, what is the reason that the compiler complains about `pow` and not about `powf`?

Prepare yourself for a bit of a headache.

In math.h I found the following:

```arduino
/**
    The function pow() returns the value of \a __x to the exponent \a__ y.
 */
extern double pow(double __x, double__ y) __ATTR_CONST__ ;
#define powf pow /**< The alias for pow(). */

```

So when Adafruit's libraries declared a function called `powf` the preprocessor renamed it `pow`.

Here comes the headache: here's Adafruit's powf function:

```arduino
float powf(const float x, const float y) {
  return (float)(pow((double)x, (double)y));
}

```

which the processor redoes to:

```arduino
float pow(const float x, const float y) {
  return (float)(pow((double)x, (double)y));
}

```

which is why the linker complains about `pow` rather than `powf`.

But... looking at the function `pow` calling the function `pow`, on the face of it, that looks like infinite recursion. I'm _guessing_, and it's only a WAG, that it's the function signatures being different that saves it.

Except that in the AVR core, `double` == `float`.

So it's the presence of `const` in Adafruit's function definition that dodges the infinite recursion?

But... given that powf is `#define`d in math.h... why is this here at all? Does some other tool chain not have powf?

Oww.

And now if you'll excuse me, I need some acetaminophen. Just one or two. Not a whole bottle...

---

<div class="post-metadata">

**Author:** ![hammy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/hammy/32/238813_2.png) [@hammy](https://forum.arduino.cc/u/hammy)\
**Post date:** [April 3, 2026, 8:12am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/8 "2026-04-03T08:12:49Z")

</div>

It might be useful to see the OP’s code , there may be another way around this if say both libraries are not needed ?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 30, 2026, 8:13am UTC](https://forum.arduino.cc/t/multiple-definition-error-code/1437992/9 "2026-09-30T08:13:25Z")

</div>

Closed on September 30, 2026, 8:13am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
