Compile error - Two header files with same name

Program I'm trying to upload bombs out with a compile error telling me I have two (different) "wifi.h" files on my system.

Evidently, avrdude is smart enough to let me know.

Which one do you use? How do you make that determination?

Which board are you compiling for ?

Please post the full error message and your full sketch

UK . . Bob

Thanks for the reply. Don't have the exact message in front of me right now, but this has happened a few times before.

So, the question is kind of in a general sense.

Right now, specifically, I have two "wifi.h" files on my system that are different. One is provided in the Arduino IDE install package, and the other is from the ESP32 core package from Espressif.

Which do I use?

I'm working with the ESP32 WROOM dev board.

That depends on which board you are using

Sometimes these header files are very similar.
I open them up with text editor looking for hints as to what the program is most likely looking for.

Hi @microburst

Arduino IDE uses a sophisticated algorithm to decide which is the best library to use when multiple libraries contain a file with name matching the filename in an #include directive. It will usually make the right choice. So you don't need to worry too much about these "Multiple libraries were found for ..." messages unless they indicate Arduino IDE chose a different library than what you intended. It is normal and expected for there to sometimes be multiple libraries available for a given #include directive.

In this case, the "WiFi" library that comes as part of the Arduino IDE installation is for use with the long retired Arduino WiFi Shield. The "WiFi" library that is bundled with the ESP32 boards platform is for use with the ESP32 boards. So the correct library for Arduino IDE to select when compiling for an ESP32 board is the "WiFi" library that is bundled with the ESP32 boards platform.

In this case, it is intentional. The API of the "WiFi" library that is bundled with the ESP32 boards platform (as well as some other common libraries for Wi-Fi communication) was based on the API of the "WiFi" library that comes as part of the Arduino IDE installation. This approach allows existing documentation, sketches, and libraries to be reused with only minor adjustments.

Thanks, that helps to clarify things.

I realize the proper thing to do is paste the error message, but I just did a fresh install of my OS (for other reasons), didn't have in handy and was just pondering this issue.

No, it's not :slight_smile: Compiler errors are not generated by avrdude but by the compiler.

Which version of the IDE are you using? I would like to move your topic to the relevant section on the forum.

Correct, yes. Compiler is generating the error.

I am using IDE 1.8.19, but my question was general in nature. I've had similar issues across all versions.

Until you post the full error message, the sketch that produced it and details of the board being used then I am afraid it is going to be be difficult to provide help

I understand that :wink: Because it's "general in nature", it would fit in Programming Questions; but because it's more specific to IDEs than to programming, it would better fit in one of the IDE categories. Hence moved to IDE 1.x

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