#include "udp.h"
void setup()
{
// put your setup code here, to run once:
UDP_Start("aaa", "vvv");
}
void loop()
{
// put your main code here, to run repeatedly:
}
I get a compile time error
c:/users/evgeny/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\main.ino.cpp.o:(.text.setup+0x8): undefined reference to `Z9UDP_StartPcS'
c:/users/evgeny/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: sketch\main.ino.cpp.o: in function `setup':
D:\Documents\AgroSensor\arduino_8266\main/main.ino:6: undefined reference to `Z9UDP_StartPcS'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board LOLIN(WEMOS) D1 mini (clone).
C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_191465\upd.cpp: In function 'uint8_t UDP_Start(char*, char*, uint16_t)':
upd.cpp:19:24: error: 'UDP_CONNECT_TIMEOUT' was not declared in this scope
19 | if (timeout >= UDP_CONNECT_TIMEOUT)
| ^~~~~~~~~~~~~~~~~~~
C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_191465\sketch_jul15a.ino: In function 'void setup()':
C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_191465\sketch_jul15a.ino:6:14: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
6 | UDP_Start("aaa", "vvv");
| ^~~~~
C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_191465\sketch_jul15a.ino:6:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
6 | UDP_Start("aaa", "vvv");
| ^~~~~
Do you know why that UDP_CONNECT_TIMEOUT identifier was not declared?
Is it really a .cpp file, or is instead in a .ino file?
These are different functions because they have different arguments. One of the functions is defined, one of them is not.
If you're not modifying the ssid and pass arguments, their type should be const char *, not char *. If you do intend to modify them, then you're not allowed to pass string literals to them.