# Cannot compile sketch

**URL:** <https://forum.arduino.cc/t/cannot-compile-sketch/1410046>\
**Category:** Programming\
**Created:** [October 20, 2025, 3:50pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046 "2025-10-20T15:50:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![falkson](https://avatars.discourse-cdn.com/v4/letter/f/c89c15/32.png) [@falkson](https://forum.arduino.cc/u/falkson)\
**Post date:** [October 20, 2025, 3:50pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/1 "2025-10-20T15:50:56Z")

</div>

Total newbie. I suspect I have not configured something. Can someone help me figure out why this is not compiling. (RGB Led ... tutorial 4).

/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/RGB\_LED.ino: In function 'void setup()':  
/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/RGB\_LED.ino:9:6: error: redefinition of 'void setup()'  
void setup()  
^ ~~~~  
/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/sketch\_oct19a.ino:1:6: note: 'void setup()' previously defined here  
void setup() {  
^ ~~~~  
/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/RGB\_LED.ino: In function 'void loop()':  
/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/RGB\_LED.ino:25:6: error: redefinition of 'void loop()'  
void loop()  
^~~~  
/private/var/folders/6n/2g\_v9kdn5n5fzgw4czrf7l3r0000gn/T/.arduinoIDE-unsaved2025919-1640-1gekegc.8opa/sketch\_oct19a/sketch\_oct19a.ino:6:6: note: 'void loop()' previously defined here  
void loop() {  
^~~~  
exit status 1

Compilation error: redefinition of 'void setup()'

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [October 20, 2025, 3:55pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/2 "2025-10-20T15:55:11Z")

</div>

- In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the **complete sketch**.  
Use the **\< CODE / \>** icon from the ‘posting menu’ to attach the copied sketch.

---

<div class="post-metadata">

**Author:** ![gilhad](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gilhad/32/996113_2.png) [@gilhad](https://forum.arduino.cc/u/gilhad)\
**Post date:** [October 20, 2025, 4:21pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/3 "2025-10-20T16:21:29Z")

</div>

It looks like you have two **setup** and two **loop** defined in your ino

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [October 20, 2025, 4:29pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/4 "2025-10-20T16:29:51Z")

</div>

I moved your topic to an appropriate forum category @falkson.

In the future, when creating a topic please take some time to pick the [forum category](https://forum.arduino.cc/categories) that best suits the subject of your topic. There is an " **About the \_\_\_\_\_ category**" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in [the " **How to get the best out of this forum**" guide](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966). The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [October 20, 2025, 4:39pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/5 "2025-10-20T16:39:20Z")

</div>

You have two .ino files in the sketch folder, each of which has a setup() and loop() function. The compiler combines all .ino files within a folder when compiling.

---

<div class="post-metadata">

**Author:** ![falkson](https://avatars.discourse-cdn.com/v4/letter/f/c89c15/32.png) [@falkson](https://forum.arduino.cc/u/falkson)\
**Post date:** [October 20, 2025, 5:03pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/6 "2025-10-20T17:03:20Z")

</div>

Thanks. Problem solved.

---

<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:** [April 18, 2026, 5:04pm UTC](https://forum.arduino.cc/t/cannot-compile-sketch/1410046/7 "2026-04-18T17:04:09Z")

</div>

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