相关文章推荐
傲视众生的鼠标垫  ·  php artisan ...·  5 月前    · 
奔跑的风衣  ·  执行“docker run ...·  10 月前    · 
留胡子的杨桃  ·  GYP ...·  1 年前    · 
直爽的烤红薯  ·  vue tinymce ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

Glad it's working for you now! I have written an answer just so this question can have an official resolution instead of only some comments. per1234 Sep 25, 2017 at 23:14

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.

    one can find a header-only Windows implementation of the <sys/time.h> header on GitHub here:

    https://github.com/win32ports/sys_time_h

    side note: RTC time implementations for the ESP32 can be found here:

    https://github.com/kerikun11/ESP32Time

    and here:

    https://github.com/fbiego/ESP32Time

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .