skorokithakis/A6lib

Add "__attribute__((used))" to function definition of sscanf

BJDayzz opened this issue · 10 comments

I tried to compile the example "dial" in Arduino V1.6.13. After I got the error message

sscanf' referenced in section .text.startup' of C:\Users\BJ\AppData\Local\Temp\ccVAm20R.ltrans0.ltrans.o: defined in discarded section `.text' of libraries\A6lib-master\sscanf.cpp.o (symbol from plugin)

I searched a bit and found this one:
https://forum.repetier.com/discussion/2389/stepperwait-referenced-in-section-text-compiliation-issues

After I changed
int sscanf(const char *buf, const char *fmt, ...) {
in sscan.cpp to
int __attribute__((used)) sscanf(const char *buf, const char *fmt, ...) {
the sketch "dial" was compileable.

Ah, thank you. Are you using an Arduino to run the sketch on, or an ESP8266? I'm not sure what __attribute__((used)) does or what it's compatible with...

Doesn't seem to hurt anything, so I've implemented it, thanks!

I tried it on the ESP8266 and it looks like it works fine, thanks for the heads up! Is the module working well for you?

Thanks for the contribution (but please open separate issues for separate things). You can create a pull request by following this guide:

https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

It looks much worse than it is, in reality you just click the "fork" button at the top, make the changes in your repo, push them and click "create pull request", and that's it.

I've added your code, thank you! It would have taken me much less time to review/accept if it were in a PR, but it was small enough to add by hand, thanks again!

It did get added, yes :)

It means "pull request", it's just a thing that tells me "please integrate my changes" and shows me the changes in a diff.