Cant use Micro-Coap library for arduino

别来无恙 提交于 2019-12-11 20:33:18

问题


I am trying to get the micro-coap librarby (https://github.com/1248/microcoap) to work on my arduino. When I try to compile it in the Arduino IDE, it reports that <sys/socket.h> dependency in main-posix.c can not be found.

Searches for the problem were not helpful, except for some general C++ answer that was hinting that there is no sys/socket.h on Windows. But this should not have anything to do with Arduino right?

I looked at the ethernet library for arduino and there is a socket.h but it is not in a sys directory.

Hope you can help


回答1:


It seems that the main-posix.c source file is meant to be compile for a UNIX/LINUX based operating system. If you want to use Windows to compile main-posix.c, you can use projects like Cygwin. Arduino does not have <sys/socket.h> dependency needed to compile main-posix.c. Instead open microcoap.ino in the Arduino IDE and compile and flash it to the hardware.




回答2:


Someone suggested simply taking the file out of the arduino path / deleting it and that worked. As Stefan posted in his answer, it is used to build the library on unix/linux and has no relevance for arduino.



来源:https://stackoverflow.com/questions/31222912/cant-use-micro-coap-library-for-arduino

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!