Home > other >  Small white learn ESP8266 encounter problems, bosses, please help
Small white learn ESP8266 encounter problems, bosses, please help

Time:09-23

When I compile the project, the following mistakes, how should solve? Ask bosses help solve
../lib/libc (lib_a - svfprintf. O) : (. A literal + 0 x10) : undefined reference to ` _malloc_r '
./lib/libc (lib_a - svfprintf. O) : a function In ` _svfprintf_r ':
/home/WJG/Repo/esp - open - SDK - 20170622/crosstool - NG/build/SRC/newlib - 2.0.0 newlib/libc/stdio vfprintf. C: 733: undefined reference to ` _malloc_r '
./lib/libc (lib_a - svfiprintf. O) : (. A literal + 0 x4) : undefined reference to ` _realloc_r '
./lib/libc (lib_a - svfiprintf. O) : (. A literal + 0 by 8) : undefined reference to ` _free_r '

./lib/libc (lib_a - svfiprintf. O) : a function In ` __ssprint_r ':
/home/WJG/Repo/esp - open - SDK - 20170622/crosstool - NG/build/SRC/newlib - 2.0.0 newlib/libc/stdio vfprintf. C: 234: undefined reference to ` _malloc_r '
/home/WJG/Repo/esp - open - SDK - 20170622/crosstool - NG/build/SRC/newlib - 2.0.0 newlib/libc/stdio vfprintf. C: 245: undefined reference to ` _realloc_r '
/home/WJG/Repo/esp - open - SDK - 20170622/crosstool - NG/build/SRC/newlib - 2.0.0 newlib/libc/stdio vfprintf. C: 249: undefined reference to ` _free_r '

./lib/libc (lib_a - svfiprintf. O) : a function In ` _svfiprintf_r ':
/home/WJG/Repo/esp - open - SDK - 20170622/crosstool - NG/build/SRC/newlib - 2.0.0 newlib/libc/stdio vfprintf. C: 733: undefined reference to ` _malloc_r
'collect2: error: ld returned 1 exit status

CodePudding user response:

# include "stdio.h"
Sprintf (buffer, "has received \ r \ nDTH11 H: % d and T: % d \ r \ n", shidu, wendu);
Espconn_sent (struct espconn *) arg, buffer, strlen (buffer));
Bosses, I put the three statements in this project are commented out, there is no problem, I this three statements whether have problem?

CodePudding user response:

Bosses, I found that if I comment out this statement, there is no mistake, what should I change, don't complain! sprintf (buffer," has been received \ r \ nDTH11 H: % d and T: % d \ r \ n ", shidu, wendu);

CodePudding user response:

https://bbs.espressif.com/viewtopic.php? T=404
https://www.esp8266.com/viewtopic.php? F=28 & amp; T=2173
See this two connection, don't # include & lt; Stdio. H> C standard library, such as using ESP8266 osapi. "h" library, sprintf substitute os_sprintf
The hope can help you

CodePudding user response:

reference 1st floor weixin_45100958 response:
# include "stdio.h"
Sprintf (buffer, "has received \ r \ nDTH11 H: % d and T: % d \ r \ n", shidu, wendu);
Espconn_sent (struct espconn *) arg, buffer, strlen (buffer));
Bosses, I put the three statements in this project are commented out, there is no problem, I this three statements whether have problem?


This a few words all have no problem, you should be the other problem caused by the problem