问题
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