# Help with an error message please?

**URL:** <https://forum.arduino.cc/t/help-with-an-error-message-please/1206253>\
**Category:** Programming\
**Created:** [January 2, 2024, 5:11pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253 "2024-01-02T17:11:32Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:11pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/1 "2024-01-02T17:11:32Z")

</div>

hi, this is my first time using an Arduino, I have a bunch of oled displays which im looking to use for a project, so I thought I would quickly try and run something on one. Im following this video [https://www.youtube.com/watch?app=desktop&v=YDkqYLt\_YHs](https://www.youtube.com/watch?app=desktop&v=YDkqYLt_YHs), I have followed everything but when I come to run the code it comes up with this error message.

Could I please have some help? Thank you.

Here is the error code.

```arduino
/private/var/folders/g5/q9v_vt016jqfjv2k_s27mgtw0000gn/T/.arduinoIDE-unsaved202402-32794-25r8fh.xm5pq/sketch_jan2c/gh.ino:32:6: error: redefinition of 'void setup()'
 void setup() {
      ^ ~~~~
/private/var/folders/g5/q9v_vt016jqfjv2k_s27mgtw0000gn/T/.arduinoIDE-unsaved202402-32794-25r8fh.xm5pq/sketch_jan2c/sketch_jan2c.ino:3:6: note: 'void setup()' previously defined here
 void setup()
      ^ ~~~~
/private/var/folders/g5/q9v_vt016jqfjv2k_s27mgtw0000gn/T/.arduinoIDE-unsaved202402-32794-25r8fh.xm5pq/sketch_jan2c/gh.ino: In function 'void loop()':
/private/var/folders/g5/q9v_vt016jqfjv2k_s27mgtw0000gn/T/.arduinoIDE-unsaved202402-32794-25r8fh.xm5pq/sketch_jan2c/gh.ino:111:6: error: redefinition of 'void loop()'
 void loop() {
      ^~~~
/private/var/folders/g5/q9v_vt016jqfjv2k_s27mgtw0000gn/T/.arduinoIDE-unsaved202402-32794-25r8fh.xm5pq/sketch_jan2c/sketch_jan2c.ino:17:6: note: 'void loop()' previously defined here
 void loop()
      ^~~~

exit status 1

Compilation error: redefinition of 'void setup()'
type or paste code here

```

---

<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:** [January 2, 2024, 5:13pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/2 "2024-01-02T17:13:41Z")

</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:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [January 2, 2024, 5:15pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/3 "2024-01-02T17:15:35Z")

</div>

Post the complete error message, also using code tags.

See the "How to get the best out of this forum" post for instructions.

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:20pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/4 "2024-01-02T17:20:28Z")

</div>

sorry how do I find that?

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [January 2, 2024, 5:22pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/5 "2024-01-02T17:22:25Z")

</div>

➜ please read [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966) and modify your post accordingly (including code tags and necessary documentation for your ask).

please, please never ever again post pictures of text... Not only they are not readable nor usable directly for copy&paste but they use up lots of storage and internet bandwidth which contributes to polluting the planet.

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:28pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/6 "2024-01-02T17:28:54Z")

</div>

sorry, I have edited it now. the error code is being shown now properly. Thanks

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [January 2, 2024, 5:37pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/7 "2024-01-02T17:37:53Z")

</div>

seems your sketch has two setup() and two loop() functions

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:46pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/8 "2024-01-02T17:46:59Z")

</div>

how would I go around fixing this then? thanks

---

<div class="post-metadata">

**Author:** ![Whandall](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/whandall/32/222457_2.png) [@Whandall](https://forum.arduino.cc/u/Whandall)\
**Post date:** [January 2, 2024, 5:55pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/9 "2024-01-02T17:55:33Z")

</div>

> [@rudd66](#):
>
> ```arduino
> sketch_jan2c/gh.ino:32:6: error: redefinition of 'void setup()'
> sketch_jan2c/sketch_jan2c.ino:3:6: note: 'void setup()' previously defined here
> 
> ```

You have two sketches in one directory, looks like the gh.ino does not belong there.

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:56pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/10 "2024-01-02T17:56:40Z")

</div>

so do I just need to run it separately?

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 5:59pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/11 "2024-01-02T17:59:33Z")

</div>

right I have just ran it separately and it is displaying something now. thank you very much

---

<div class="post-metadata">

**Author:** ![Whandall](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/whandall/32/222457_2.png) [@Whandall](https://forum.arduino.cc/u/Whandall)\
**Post date:** [January 2, 2024, 5:59pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/12 "2024-01-02T17:59:49Z")

</div>

In one directory, they will get combined.

---

<div class="post-metadata">

**Author:** ![rudd66](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rudd66](https://forum.arduino.cc/u/rudd66)\
**Post date:** [January 2, 2024, 6:00pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/13 "2024-01-02T18:00:11Z")

</div>

Ahh ok, that's good to know now, thank you again.

---

<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:** [June 30, 2024, 6:00pm UTC](https://forum.arduino.cc/t/help-with-an-error-message-please/1206253/14 "2024-06-30T18:00:42Z")

</div>

Closed on June 30, 2024, 6:00pm UTC

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