GramThanos / WakeOnLAN

A simple C program that sends a magic packet
MIT License
100 stars 35 forks source link

Not work under Mac #2

Closed kwccoin closed 2 years ago

kwccoin commented 4 years ago
gcc WakeOnLAN.c -o WakeOnLAN
WakeOnLAN.c:94:21: error: variable has incomplete type 'struct sockaddr_in'
        struct sockaddr_in udpClient, udpServer;
                           ^
WakeOnLAN.c:94:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in udpClient, udpServer;
               ^
WakeOnLAN.c:94:32: error: variable has incomplete type 'struct sockaddr_in'
        struct sockaddr_in udpClient, udpServer;
                                      ^
WakeOnLAN.c:94:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in udpClient, udpServer;
               ^
WakeOnLAN.c:113:69: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]
        printf("Packet will be sent to %02hhx:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
                                       ~~~~~~                              ^~~~~~
                                       %02x
1 warning and 2 errors generated.
n8ta commented 3 years ago

@kwccoin I submitted a PR to add macOS support. Please let me know if you have any issues. I've tested on an older macbook but not any of the new ones. https://github.com/GramThanos/WakeOnLAN/pull/3

If you need it before it gets merged my fork is here: https://github.com/n8ta/WakeOnLAN/

Edit: It has been merged. You should be good to go!

lucapalano commented 2 years ago

It's woking on my MAC 10.14 (compiled with Apple clang version 11.0.0).