简体   繁体   中英

Arduino IDE doesn't find sys/time.h in Windows

I'm trying to follow this tutorial to start testing my new Adafruit Azure IoT starter Kit that comes with an Arduino Feather M0 Wifi. I was able to setup the Arduino IDE 1.8.4 (From Windows Store) on my PC which is a Windows 10. In the step 1.8 (Build Your Remote Monitoring Sample), when I try to compile the solution "remote_monitoring.ino" dowonload from here , it appears the following error:

C:\\iot-hub-c-m0wifi-getstartedkit-master\\remote_monitoring\\remote_monitoring.ino:12:22: fatal error: sys/time.h: No such file or directory

#include <sys/time.h>

compilation terminated.

exit status 1 Error compiling for board Arduino/Genuino Uno.

It seems like in Windows, including sys/time.h just doesn't Works, but if I try to delete the sys/ part, it comes the following error:

C:\\Users\\jonguz\\OneDrive - Microsoft\\Documents\\Arduino\\libraries\\AzureIoTHub\\src/sdk/serializer.h:42:19: fatal error: cstdlib: No such file or directory

#include <cstdlib>

I appreciate your help.

sys/time.h and cstdlib are located in the toolchain used by the Adafruit SAMD Boards hardware package (specifically arm-none-eabi-gcc). The files in this tool are only added to the include search path when a board that uses that tool is selected in the Tools > Board menu. If you don't have one of those boards selected then the file will not be found, thus the error messages you encountered.

From https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-with-arduino-ide :

Select the matching board, the current options are:

  • Feather M0 (for use with any Feather M0 other than the Express)

So the solution is to select Tools > Board > Adafruit Feather M0 after installing Adafruit SAMD Boards via Boards Manager but before compiling the sketch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM