A caching issue arose with an Arduino Sketch build when some of the source files were renamed. Solution was simple.

When building an Arduino Sketch got the following indicating multiple definition of …

c:/users/me/appdata/local/arduino15/packages/rp2040/tools/pqt-gcc/2.2.0-d04e724/bin/../lib/gcc/arm-none-eabi/12.3.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\me\AppData\Local\Temp\arduino\sketches\DA600D9A6C5C6D718E8A64F5C6C6B554\sketch\src\ic_74hc595_shiftRegister.cpp.o: in function _Z14_writeTo595_168BitOrderj': C:\Users\me\source\Softata\Softata\src/ic_74hc595_shiftRegister.cpp:12: multiple definition of _Z14_writeTo595_168BitOrderj’; C:\Users\me\AppData\Local\Temp\arduino\sketches\DA600D9A6C5C6D718E8A64F5C6C6B554\sketch\src\ic74hc595.cpp.o:C:\Users\me\source\Softata\Softata\src/ic74hc595.cpp:12: first defined here

The problem arose after some class ic595 source files were renamed as ic_74hc595_shiftRegister

After much investigation it was realized that the issue was cached data. Looking in C:\Users\me\AppData\Local\Temp\arduino\sketches\DA600D9A6C5C6D718E8A64F5C6C6B554 there was a copy of the sketch plus other built files. Some of the files used the deleted source file name.

ic595 files had been renamed as ic_74hc595_shiftRegister yet there was a couple of both sets of file in the DA600D9A6C5C6D718E8A64F5C6C6B554\sketch\src folder. So there were multiple definitions of some entities in either versions of the source files.

The solution was to just delete the DA600D9A6C5C6D718E8A64F5C6C6B554 folder and rebuild! :)

Just ran into same problem after renaming another class and similarly renaming its header and source file names! :)


 TopicSubtopic
  Next: > Note to Self
<  Prev:   Softata