Error compiling.....

Hello guys,

I am getting the error of "Multiple libraries were found for "Max3421e.h" even though there are no libraries based on Max3421e. Please have a look at the image I attached to this message.

I am requesting you to please help me in this regard.

Thank you.

Hi there. Please post your code with links and/or references to the libraries (non-standard) you use. Copy and post the error messages as well. Without this we can offer no support. Many do this from their phone while commuting, etc., if we can't see it on this screen, we can't see it period.

even though there are no libraries based on Max3421e

Your code #includes this library so I am not sure what you mean.

How many copies of the .h file do you have on your PC and where are they located ?

Hi,

Thank you for the quick response.

Here is the link for the code:USB_Host_Shield/board_test.pde at master · felis/USB_Host_Shield · GitHub

Here is the link for library:GitHub - felis/USB_Host_Shield: Libraries and code for Circuits@Home Arduino USB Host Shield

Here is the error:

Arduino: 1.8.7 (Windows 7), Board: "Arduino Mega ADK"

Multiple libraries were found for "Max3421e.h"
board_test:7:17: error: Usb.h: No such file or directory

Used: C:\Program Files (x86)\Arduino\libraries\usb_host_patched
#include <Usb.h>

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
^

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
compilation terminated.

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
exit status 1
Usb.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I removed all the libraries based on Max3421e, but still I am getting the error : Multiple libraries were found for "Max3421e.h"

Hi bob,

I removed all the libraries or files based on Max3421e from my pc, but still I am getting the following error:

Arduino: 1.8.7 (Windows 7), Board: "Arduino Mega ADK"

Multiple libraries were found for "Max3421e.h"
board_test:7:17: error: Usb.h: No such file or directory

Used: C:\Program Files (x86)\Arduino\libraries\usb_host_patched
#include <Usb.h>

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
^

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
compilation terminated.

Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
Not used: C:\Program Files (x86)\Arduino\libraries\USB_Host_Shield
exit status 1
Usb.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Please copy the code that you are actually compiling from your IDE and post it here

Are you #including Usb.h or not ?

Here is the main part of the code :

//#include <SPI.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Usb.h>

#include "board_test.h" /* Board test messages */

//#define MAX_SS 10

void setup();
void loop();

MAX3421E Max;
USB Usb;

void setup()
{
  Serial.begin( 115200 );
  //Serial.println("Start");
  //Serial.println( SCK_PIN, DEC );
  Max.powerOn();
  printProgStr( startBanner );
  printProgStr( anykey_msg );
  //Serial.print( Max.getvar(), DEC);
}

void loop()
{
  while( Serial.available() == 0 );  //wait for input
  Serial.read();                     //empty input buffer
  /* start tests */
  /* SPI short test */
  if (!revregcheck()) test_halted();
  /* GPIO test */
  if (!gpiocheck()) printProgStr(PSTR("\r\nGPIO check failed. Make sure GPIO loopback adapter is installed"));
  /* SPI long test */
  if (!spitest()) test_halted();      //test SPI for transmission errors
  if (!osctest()) printProgStr(PSTR("OSCOK test failed. Check the oscillator"));
  if (!usbtest()) printProgStr(PSTR("USB connection test failed. Check traces from USB connector to MAX3421E, as well as VBUS"));  //never gets here
    /* All tests passed */
  printProgStr( anykey_msg );
}

yes, I have included Usb.h file.

#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Usb.h>

#include "board_test.h" /* Board test messages */

Whereabouts are these 4 files located on your PC and how many copies of them do you have ?

Initially I installed a library which contains these files in libraries section of arduino folder :

C:\Program Files (x86)\Arduino\libraries

Then I compiled the code, I got the error : Multiple libraries were found for "Max3421e.h"

there is no error regarding Usb.h file in this case.

Secondly, I removed the library and there are no other copies of this library existing on my PC.

Then I compiled the code again, I got the error:

Multiple libraries were found for "Max3421e.h"
board_test:7:17: error: Usb.h: No such file or directory

The common error in both the cases : Multiple libraries were found for "Max3421e.h"

To be clear. You have no files named Max3421e.h on your PC ?
Is that correct ?

Have you restarted the IDE since installing and/or removing the libraries ?

The USB Host shield uses the max3421 chip so installing the USB Host shield library includes files for the max3421. You are using an 8 year old obsolete version of the USB host shield library.

The current version is at GitHub - felis/USB_Host_Shield_2.0: Revision 2.0 of USB Host Library for Arduino. but you can install it using the IDE library manager. Be sure to remove the obsolete version first. Also remove any example programs from the old library since they probably no longer work with the latest version.

vamshich:
Initially I installed a library which contains these files in libraries section of arduino folder :

C:\Program Files (x86)\Arduino\libraries

Unlikely to be the cause of your problem, but you should never install libraries to that location. The reason is everything you install to the Arduino IDE installation folder will be lost when you update to a new version of the Arduino IDE. For this reason, you should always install libraries to the libraries subfolder of the sketchbook folder. You can find/change the location of the sketchbook folder in the Arduino IDE at File > Preferences > Sketchbook location.

More information on installing libraries:
https://www.arduino.cc/en/Guide/Libraries

vamshich:
The common error in both the cases : Multiple libraries were found for "Max3421e.h"

That's not an error. It's just some helpful information the Arduino IDE displays. As long as it shows that the intended library was used, you don't need to worry about it.

The only error you've been getting is "Board_test:7:17: error: Usb.h: No such file or directory". It is confusing how the "multiple libraries" messages are being interleaved with the "No such file or directory" error. I haven't seen that before.

I'm not sure why you're getting the "Usb.h: No such file or directory" error. The USB_Host_Shield library does contain a file named Usb.h. I suspect you might not have installed the library correctly.