Troubleshooting Compile error

I wrote some code, tried to compile it (which failed) but the subsequent compile log isn’t really informative for me as to what went wrong.

Does anyone have an idea? Libraries I used for it are adxl362, ADXL362DMA and google-maps-device-locator (all found within the Particle IDE)

Hi @Vitesze

When you see these errors related to _write, _read, _fseek etc. that means that you are using a C/C++ function that depends on having file system like printf or fopen, but there is no file system on small micros.

Normally people accidentally write printf when they mean Serial.print or similar.

2 Likes

Ah, thanks so much! It makes sense as I’ve been working with a lot of these functions lately, so it’s good to know where I should start looking for the culprit(s).

Just trying to dig my code understanding what’s going wrong. Would something like this create any issues?

sprintf(buffer, “d: %i, du: %.02f d1: %i d2: %i”, d, du, d1[31], d2[31]);
Serial.println(buffer);

sprintf is fine, but snprintf is safer and a good habit to get into. Using sprintf or snprintf can cause your firmware to become larger, but that is the only downside and I use it all the time.

If you can post your code we can help look. Usually this is left over printf debugging or something turned on a #define that was unexpected.

You could also try a divide-and-conquer strategy and comment out each library and section of your code in turn and see if it compiles.

1 Like

You’re right :grinning: Actually in my 700 lines of code, I found one printf hidden away somewhere. The code now works the way it’s supposed to.

2 Likes