Olimex Support Forum

ARM => ST => Topic started by: spomue on February 20, 2015, 04:23:47 PM

Title: using sprintf "undefined reference to `_sbrk'"
Post by: spomue on February 20, 2015, 04:23:47 PM
I want to use the sprintf-Funktion. But if I use it like

char   str[128];
sprintf(str, "%s: Vers: %s, %s %s\r", GSE_SOFTW_NAME, GSE_FW_VERSION, __DATE__, __TIME__);

I get the error msg: undefined reference to `_sbrk'

What is the Problem?? Please can help me anybody?

Thanks
Title: Re: using sprintf "undefined reference to `_sbrk'"
Post by: MBR on March 07, 2015, 07:02:47 AM
Try adding #include <unistd.h>.
Title: Re: using sprintf "undefined reference to `_sbrk'"
Post by: spomue on March 18, 2015, 10:54:08 AM
Doesn't work.
And sscanf also generate this error.
Title: Re: using sprintf "undefined reference to `_sbrk'"
Post by: JohnS on March 18, 2015, 12:28:46 PM
Wrong compiler version, wrong lib, wrong command line or the like.

John
Title: Re: using sprintf "undefined reference to `_sbrk'"
Post by: spomue on March 18, 2015, 01:03:03 PM
OK. But what can I do to use sscanf or sprintf or other functions?
Title: Re: using sprintf "undefined reference to `_sbrk'"
Post by: JohnS on March 18, 2015, 01:44:26 PM
Find what you've done wrong as I posted.

John