c18

Link step can't find symbols (XC8 compiler)

两盒软妹~` 提交于 2020-01-05 05:55:45
问题 I'm trying to compile and link a C program using the XC8 compiler. I changed from the C18 compiler and made some minor compatibility changes to the code. With C18, the code compiled and linked just fine. With XC8, compiling goes fine, but the link step fails with this error: Error [500] ; 0. undefined symbols: _putch(server.obj) _ENC_Init(server.obj) _ENC_WriteRegister(server.obj) _ENC_ReadRegister(server.obj) As the compiling succeeds, I guess there are prototypes found, ergo the .h files

parsing ip adress string in 4 single bytes

£可爱£侵袭症+ 提交于 2019-12-06 11:32:14
I'm programming on a MCU with C and I need to parse a null-terminated string which contains an IP address into 4 single bytes. I made an example with C++: #include <iostream> int main() { char *str = "192.168.0.1\0"; while (*str != '\0') { if (*str == '.') { *str++; std::cout << std::endl; } std::cout << *str; *str++; } std::cout << std::endl; return 0; } This code prints 192, 168, 0 and 1 each byte in a new line. Now I need each byte in a single char, like char byte1, byte2, byte3 and byte4 where byte1 contains 1 and byte4 contains 192... or in a struct IP_ADDR and return that struct then,