sprintf compiler warning only with arguments and only in some projects

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

This is very strange as it's such a common basic thing, I don't know what could cause this.

   

This compiles:

   

sprintf(outputstring, "data = 5");

   

This does not:

   

sprintf(outputstring, "data = %i", 5);

   

Creator reports an error "Build error: The command 'arm-none-eabi-gcc.exe' failed with exit code '1'."

   

outputstring is global. Without the %i parameter it not only compiles but it also works just fine. Other types, such as %s, trigger the same error. If I include the %i without supplying an integer I get the correct error that a parameter is missing.

   

In a fresh project sprintf with parameters works fine just as one would expect.

   

The only project where I have this problem so far is the 100 Projects in 100 Days, Day009_DynamicBroadcaster.

   

(I've been trying to debug DynamicBroadcaster because while it broadcasts the data in the advertisement never changes. That's a different issue though)

   

Any ideas?

0 Likes
1 Solution
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Increase your heap size.

View solution in original post

0 Likes
3 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Increase your heap size.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The program compiled when I set "Use newlib-nano float formatting" to true. Seems a bit strange...

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob! I don't know how you figured this out, you were correct. Setting "Use newlib-nano float formatting" to true in the project's build settings resolved this compile error.

   

Now I'm able to make some real progress on this project.

Thanks to bobgoar as well. I did try increasing the heap size but it didn't resolve this particular issue for me.

0 Likes