# IDE2 Bit Upset Need Help

**URL:** <https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513>\
**Category:** IDE 2.x\
**Created:** [May 21, 2023, 9:03pm UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513 "2023-05-21T21:03:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![imk123](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imk123/32/1013044_2.png) [@imk123](https://forum.arduino.cc/u/imk123)\
**Post date:** [May 21, 2023, 9:03pm UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/1 "2023-05-21T21:03:44Z")

</div>

Hello,  
Been getting on really well with IDE 2 but this evening it is being troublesome.  
(1) I keep a backup disk of my sketches (folder copy) and I accidentally clicked on the backup ino file and now I have two projects of same name in my Open Recent list. (My Bad)

(2) Project I am currently has an ino and four other .cpp and five .h files.  
I wanted to change the name of one the .cpp and .h to something different.  
So I created the new file/names in the sketch, copy/pasted the files content from org file to new file, saved the sketch, than selected and deleted the org .cpp and .h.

Now when I try to build I get multiple declarations of functions and variables as IDE2 seems to be finding the org deleted files and/or there function/variable names which are in fact gone!

So I guess IDE2 has some cache hidden away somewhere; where is it and can I just delete it to clear all my projects and fresh start please?  
Many thanks imk

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 22, 2023, 4:48am UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/2 "2023-05-22T04:48:19Z")

</div>

You don't mention which operating system you're using. For Windows

1. I think (!) that the cache is here: `C:\Users\yourUsername\AppData\Local\Temp\arduino`
2. For the recent sketches, look in `C:\Users\yourUsername\.arduinoIDE`

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [May 22, 2023, 4:52am UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/3 "2023-05-22T04:52:17Z")

</div>

Hi @imk123

> [@imk123](#):
>
> now I have two projects of same name in my Open Recent list.

You can clear the **File \> Open Recent** menu by deleting the file at this path:

### Windows

```plaintext
C:\Users\<username>\.arduinoIDE\recent-sketches.json

```

(where `<username>` is your Windows username)

### Linux

```plaintext
~/.arduinoIDE/recent-sketches.json

```

### macOS

```plaintext
~/.arduinoIDE/recent-sketches.json

```

Or you can even open the file in a text editor and modify it if you want to preserve some of the current menu contents.

> [@imk123](#):
>
> Now when I try to build I get multiple declarations of functions and variables as IDE2 seems to be finding the org deleted files and/or there function/variable names which are in fact gone!

This bug is being tracked by the Arduino developers here:

> <https://github.com/arduino/arduino-cli/issues/1240>
>
> \### Describe the problem
> 
> The previous file persists in the sketch build folder …after a sketch code file with extension other than \`.ino\`/\`.pde\` is renamed.
> 
> 🐛 This can result in spurious compilation errors or confusing bugs. Arduino CLI users can work around the bug by adding the \`--clean\` flag to their command, but the only workaround for Arduino IDE users is to manually clean the build folder.
> 
> \### To reproduce
> 
> \`\`\`text
> $ arduino-cli version
> 
> arduino-cli.exe Version: git-snapshot Commit: a735ddfd Date: 2023-01-15T01:00:07Z
> 
> $ arduino-cli sketch new /tmp/FooSketch
> 
> $ echo "void asdf() {}" \> /tmp/FooSketch/foo.cpp
> 
> $ arduino-cli compile --fqbn arduino:avr:uno /tmp/FooSketch
> 
> \[...\]
> 
> $ mv /tmp/FooSketch/foo.cpp /tmp/FooSketch/bar.cpp
> 
> $ arduino-cli compile --fqbn arduino:avr:uno /tmp/FooSketch
> 
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketch-2405C4C9F90028537C79B0744BCE536E\\sketch\\foo.cpp.o (symbol from plugin): In function \`asdf()':
> (.text+0x0): multiple definition of \`asdf()'
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketch-2405C4C9F90028537C79B0744BCE536E\\sketch\\bar.cpp.o (symbol from plugin):(.text+0x0): first defined here
> collect2.exe: error: ld returned 1 exit status
> 
> Used platform Version Path
> arduino:avr 1.8.6 C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6
> 
> Error during build: exit status 1
> 
> $ ls "C:/Users/per/AppData/Local/Temp/arduino/sketch-2405C4C9F90028537C79B0744BCE536E/sketch"
> 
> bar.cpp bar.cpp.d bar.cpp.o foo.cpp foo.cpp.d foo.cpp.o FooSketch.ino.cpp FooSketch.ino.cpp.d FooSketch.ino.cpp.o
> \`\`\`
> 
> 🐛 \`foo.cpp\` is still present in the build folder even though not present in the sketch. \`foo.cpp\` is compiled in addition to \`bar.cpp\` and the primary sketch file.
> 
> \### Expected behavior
> 
> Files are always removed from the sketch build folder when no longer present in the sketch.
> 
> \### Arduino CLI version
> 
> \#### Original report
> 
> Arduino IDE 1.6.9
> 
> \#### Last verified with
> 
> 0.34.1
> 
> \### Operating system
> 
> \- Linux
> \- Windows
> 
> \### Operating system version
> 
> \- Mint
> \- 10
> 
> \### Additional context
> 
> \#### Workaround
> 
> \<a name="workaround-cli"\>\</a\>
> 
> \##### Arduino CLI users
> 
> Run an \`arduino-cli compile\` command with \[the \`--clean\` flag\](https://arduino.github.io/arduino-cli/dev/commands/arduino-cli\_compile/#options).
> 
> \<a name="workaround-ide"\>\</a\>
> 
> \##### Arduino IDE users
> 
> 1. Examine the compiler error message. It will show the path of the temporary build folder.
> For example, in this error:
> \`\`\`text
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\foo.cpp.o (symbol from plugin): In function \`asdf()':
> (.text+0x0): multiple definition of \`asdf()'
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\bar.cpp.o (symbol from plugin):(.text+0x0): first defined here
> collect2.exe: error: ld returned 1 exit status
>    
> exit status 1
>    
> Compilation error: exit status 1
> \`\`\`
> The temporary build folder is:
> \`\`\`text
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\
> \`\`\`
> 1. Delete the temporary build folder.
> 
> \#### Additional reports
> 
> \- https://github.com/arduino/arduino-cli/issues/1699
> \- https://github.com/arduino/arduino-cli/issues/2058
> \- https://github.com/arduino/arduino-cli/issues/2613
> \- https://github.com/arduino/arduino-cli/issues/2870
> \- https://github.com/arduino/arduino-ide/issues/970
> \- https://github.com/arduino/arduino-ide/issues/1316
> \- https://github.com/arduino/arduino-ide/issues/1691
> \- https://github.com/arduino/arduino-ide/issues/2323
> \- https://github.com/arduino/arduino-ide/issues/482#issuecomment-2188269824
> \- https://github.com/arduino/Arduino/issues/2072
> \- https://forum.arduino.cc/t/ide-and-compiler-clear/1077526
> \- https://forum.arduino.cc/t/changed-tab-name-in-sketch-still-linking-old-o-file/1046286
> \- https://forum.arduino.cc/t/weird-error-pointing-to-old-code/1113608
> \- https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513
> \- https://forum.arduino.cc/t/renamed-tabs-wont-go-away/1165338
> \- https://forum.arduino.cc/t/file-renaming-issue/1173234/6
> \- https://forum.arduino.cc/t/reorganizing-code-w-wire-h-library/1180211
> \- https://forum.arduino.cc/t/ide-not-recognising-file-type-change-from-c-to-cpp/1215993
> \- https://forum.arduino.cc/t/code-compiles-in-old-ide-but-not-the-new-one/1286767
> \- https://forum.arduino.cc/t/problem-while-defining-namespaces-with-it-own-cpp-and-hpp-files/1304403
> \- https://forum.arduino.cc/t/there-is-a-bug-in-the-wire-library-for-version-1-8-6-avr-boards/1336297/18
> \- https://forum.arduino.cc/t/new-version-of-arduino-ide-2-3-5-error/1371224/20
> \- https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114
> \- https://forum.arduino.cc/t/ld-problems-with-multiple-source-files/1381506/6
> \- https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/12
> 
> \---
> 
> \<details\>
> \<summary\>\<b\>Keywords\</b\>\</summary\>
> \<p\>
> 
> \- rename
> \- header
> \- .h
> \- .cpp
> \- .c
> \- C++
> 
> \</p\>
> \</details\>
> 
> \### Issue checklist
> 
> \- \[X\] I searched for previous reports in \[the issue tracker\](https://github.com/arduino/arduino-ide/issues?q=)
> \- \[X\] I verified the problem still occurs when using the latest \[nightly build\](https://www.arduino.cc/en/software#nightly-builds)
> \- \[X\] My report contains all necessary details

> [@imk123](#):
>
> So I guess IDE2 has some cache hidden away somewhere; where is it

My recommendation is to do a surgical deletion only of the temporary build folder for the sketch rather than clearing the cache entirely. The reason is that the cache of compiled cores speeds up compilation significantly and if you clear everything then you are going to have to wait for a fresh core compilation the next time you compile for each given board.

We can extract the temporary build folder for the sketch from the verbose output so I'm going to ask you to share that output:

Please do this:

1. Open the troubled sketch in Arduino IDE.
2. Select **File \> Preferences** from the Arduino IDE menus.
3. Check the box next to " **Show verbose output during: ☐ compilation**".
4. Click the **OK** button.
5. Select **Sketch \> Verify/Compile** from the Arduino IDE menus.
6. Wait for the compilation to fail.
7. You will see a " **Compilation error: ...**" notification at the bottom right corner of the Arduino IDE window. Click the **COPY ERROR MESSAGES** button on that notification.
8. Open a forum reply here by clicking the **Reply** button.
9. Click the **`<CODE/>`** icon on the post composer toolbar.  
This will add the forum's code block markup ( **`````** ) to your reply to make sure the error messages are correctly formatted.  
 ![Code tags icon on toolbar](https://europe1.discourse-cdn.com/arduino/original/4X/f/3/4/f34b0ef2ecd107da4bf127b3c0bc1c28569e7fe0.png)
10. Press **Ctrl+V**.  
This will [paste](https://lifehacker.com/how-to-copy-cut-and-paste-for-beginners-5801525) the compilation output into the code block.
11. Move the cursor outside of the code tags before you add any additional text to your reply.
12. Click the **Reply** button to post the output.

* * *

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a `.txt` file and then attach that file to a reply here:

1. Open any text editor program.
2. [Paste](https://lifehacker.com/how-to-copy-cut-and-paste-for-beginners-5801525) the copied output into the text editor.
3. Save the file in `.txt` format.
4. Open a forum reply here by clicking the **Reply** button.
5. Click the "Upload" icon ( ![Upload icon](https://europe1.discourse-cdn.com/arduino/original/4X/c/0/0/c0067471d5eb440267189d84a0c94cfed541a968.png)) on the post composer toolbar:  
 ![Upload icon on toolbar](https://europe1.discourse-cdn.com/arduino/original/4X/3/0/1/30174157d368457aa9e1c9f5fb673d691a6e1516.png)
6. Select the `.txt` file you saved.
7. Click the **Open** button.
8. Click the **Reply** button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the `.txt` file onto the post composer field to attach it.

---

<div class="post-metadata">

**Author:** ![imk123](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imk123/32/1013044_2.png) [@imk123](https://forum.arduino.cc/u/imk123)\
**Post date:** [May 22, 2023, 12:35pm UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/4 "2023-05-22T12:35:25Z")

</div>

Hello All and many thanks for the replies.  
OS is Win10 forgot to mention My Bad, tried Win 11 is Five Star Rubbish!  
All sorted now many thanks again imk  
PS This has to be best Forum on the web

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [May 22, 2023, 7:42pm UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/5 "2023-05-22T19:42:48Z")

</div>

You are welcome. I'm glad it is working now.

Regards,  
Per

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 18, 2023, 7:43pm UTC](https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513/6 "2023-11-18T19:43:04Z")

</div>

Closed on November 18, 2023, 7:43pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
