# Maybe a stupid question

**URL:** <https://forum.arduino.cc/t/maybe-a-stupid-question/1401408>\
**Category:** IDE 2.x\
**Created:** [August 10, 2025, 1:45am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408 "2025-08-10T01:45:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapskallyun](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rapskallyun](https://forum.arduino.cc/u/rapskallyun)\
**Post date:** [August 10, 2025, 1:45am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/1 "2025-08-10T01:45:15Z")

</div>

When in the Arduino IDE I see that there are multiple tabs at the top for different sketches. It seems to me that when I hit upload it should only upload the current tab I’m working in but some of the error messages I’ve gotten say things about not being able to find or upload code from a different tab so I guess my question is ‘does IDE try to upload all the sketch tabs and I need to open a new instance/window every time I want to work with a single sketch?’

Please tell me if I’m not making any sense. I’m brand new to this and don’t quite understand a lot of what I’m doing.

---

<div class="post-metadata">

**Author:** ![superbwoodpecker791](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/superbwoodpecker791/32/1108294_2.png) [@superbwoodpecker791](https://forum.arduino.cc/u/superbwoodpecker791)\
**Post date:** [August 10, 2025, 1:50am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/2 "2025-08-10T01:50:47Z")

</div>

> [@rapskallyun](#):
>
> does IDE try to upload all the sketch tabs

Yes it does.

> [@rapskallyun](#):
>
> and I need to open a new instance/window every time I want to work with a single sketch?

Yes 😎

---

<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:** [August 23, 2025, 12:46pm UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/3 "2025-08-23T12:46:17Z")

</div>

Split this topic on August 23, 2025, 12:46pm UTC

14 posts were split to a new topic: [Compilation fails: "WiFi.h: No such file or directory"](https://forum.arduino.cc/t/compilation-fails-wifi-h-no-such-file-or-directory/1403894)

---

<div class="post-metadata">

**Author:** ![grb](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grb/32/1201129_2.png) [@grb](https://forum.arduino.cc/u/grb)\
**Post date:** [August 10, 2025, 2:22am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/5 "2025-08-10T02:22:59Z")

</div>

> [@rapskallyun](#):
>
> When in the Arduino IDE I see that there are multiple tabs at the top for different sketches.

I think the more accurate way to put this is that there are multiple tabs for different source code files that constitute components of a _single_ sketch.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 10, 2025, 3:05am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/6 "2025-08-10T03:05:40Z")

</div>

One sketch folder can contain several files. The most common arrangement is a single ino, a single .h and multiple cpp. It can also be multiple ino but that comes with special rules and offers no advantage that I know of.

These arrangements are for normal user sketches NOT library development.

---

<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:** [August 10, 2025, 3:16am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/8 "2025-08-10T03:16:07Z")

</div>

> [@sonofcy](#):
>
> offers no advantage that I know of

It offers the following advantages:

- Automated function prototype generation
- Doesn't require an understanding of the concept of "[translation units](https://wikipedia.org/wiki/Translation_unit_%28programming%29)"

I accept that some advanced users will not consider either of those to be advantages. However, for users at an intermediate experience level wanting to split up a sketch project into multiple files without having to first learn additional fairly complex programming concepts, the multiple `.ino` files approach may be a good option.

---

<div class="post-metadata">

**Author:** ![rapskallyun](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rapskallyun](https://forum.arduino.cc/u/rapskallyun)\
**Post date:** [August 10, 2025, 4:29am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/9 "2025-08-10T04:29:14Z")

</div>

I’m not even intermediate yet, I just started this week and overall I’m having a blast and enjoying learning all this stuff. a few things are frustrating and confusing but I’ll keep trying and asking for help so I can get better.

---

<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:** [August 10, 2025, 5:29am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/10 "2025-08-10T05:29:05Z")

</div>

> [@rapskallyun](#):
>
> multiple tabs at the top for different sketches.

Let's try to clarify what a sketch is.

A sketch is a directory on your PC. It can contain multiple files but it must have one ino file with the same name as the directory.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 10, 2025, 11:01am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/11 "2025-08-10T11:01:38Z")

</div>

But aren’t they processed in alphabetical order? And at that level, will they know about forward declarations, etc?

---

<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:** [August 10, 2025, 12:22pm UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/12 "2025-08-10T12:22:22Z")

</div>

All `.ino` files are concatenated into a single file. The generated function prototypes are added at the top of that file.

So you can call any function from any of the `.ino` files at any point in the sketch, without needed to manually add a function prototype/forward declaration before that point, exactly the same as how it works if all the code is in a single `.ino` file.

As for manually added declarations, you can reference the declared object at any point in the sketch after the declaration, just the same as how it works if all the code is in a single `.ino` file.

I provided a more detailed explanation here:

> [@Tabbed Sketches - Suggestion or How to](https://forum.arduino.cc/t/tabbed-sketches-suggestion-or-how-to/1393854/13):
>
> Hi @flynace. Just in case you aren't already aware, I'll describe the way to add a "tab" to your sketch: Click the ●●● icon (or if you are using Arduino IDE 1.x, the ▼ icon) at the right side of the tab bar in Arduino IDE. A menu will open. Select "New Tab" from the menu. The "Name for new file" dialog will open. Type the name you want to use for the tab. Click the "OK" button. The dialog will close and you will see that a new tab has been added to the sketch. It is important to understa…

and a bit further here:

> [@Tabbed Sketches - Suggestion or How to](https://forum.arduino.cc/t/tabbed-sketches-suggestion-or-how-to/1393854/19):
>
> Yes, click the magnifying glass icon on the "activity bar" at the left side of the Arduino IDE window. This will open the "SEARCH" view in the left side panel of the Arduino IDE window. That can be used to find text across the entire sketch. You can obtain the C++ file that is generated by the Arduino sketch build system: Select File \> Preferences... (or Arduino IDE \> Settings... for macOS users) from the Arduino IDE menus. The "Preferences" dialog will open. Check the box next to "Show ve…

---

<div class="post-metadata">

**Author:** ![summguy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/summguy/32/1099112_2.png) [@summguy](https://forum.arduino.cc/u/summguy)\
**Post date:** [August 10, 2025, 3:44pm UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/13 "2025-08-10T15:44:07Z")

</div>

I had the same question about opening a new sketch - why is a new instance window of the IDE opened instead of adding a new tab to the current instance but I guess opening a new instance of the IDE is necessary or expected behavior.

Regarding the tabs in any given instance, I have ESP32\_SPI\_9341.h open in the second tab when I open some sketches - I don’t know why that .h file is occupying the second tab, does it have to be? How do you close a tab? I only see “delete”. Not sure what exactly that does. Do I have to open any of the .h files that are #included in the sketch (do they have to be present in other tabs) ?

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 10, 2025, 4:11pm UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/14 "2025-08-10T16:11:38Z")

</div>

A second copy of the IDE opens if you open a second sketch (folder).

If you have an .ino and a .h file in the sketch folder, they will get opened in separate tabs. There is no need to close the second tab; it is there as a convenience in case you need to edit it.

Most #included .h files are NOT in your sketch folder, so do not create a tab. Those are part of the library system.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 10, 2025, 4:20pm UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/15 "2025-08-10T16:20:11Z")

</div>

I did a test to check, and YES if you delete a tab you delete the underlying file, so be very careful with that.

Another related thing you may find handy is after and only after a successful compile you can then highlight/click an include and the file will be opened READ ONLY (the LOCK icon) in a new tab. That tab will have a close X at the right edge. Useful for seeing what member functions are available for a class, but there is another method too (clue start typing)

![Screenshot 2025-08-10 at 12.18.21](https://europe1.discourse-cdn.com/arduino/original/4X/9/4/9/9492222d438618287d0ff97c9b82c02a84da4c76.png)

---

<div class="post-metadata">

**Author:** ![westfw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/westfw/32/213443_2.png) [@westfw](https://forum.arduino.cc/u/westfw)\
**Post date:** [August 11, 2025, 12:37am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/16 "2025-08-11T00:37:10Z")

</div>

> One sketch folder can contain several files. The most common arrangement is a single ino, a single .h and multiple cpp.

Well, the most common arrangement is a single .ino file, and no additional tabs.  
**IF** there are multiple tabs, the .h and .cpp file setup is likely.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 11, 2025, 12:56am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/17 "2025-08-11T00:56:17Z")

</div>

Of course, I meant the most common multi-file arrangement is ….

---

<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:** [August 11, 2025, 2:16am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/18 "2025-08-11T02:16:43Z")

</div>

> [@sonofcy](#):
>
> One sketch folder can contain several files. The most common arrangement is a single ino, a single .h and multiple cpp.

Why a single .h?

I use a .h and a .cpp per "module"; e.g. a .cpp and corresponding .h for button functionality and a .cpp and .h for output (LED) functionality.

---

<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:** [August 11, 2025, 4:59am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/19 "2025-08-11T04:59:36Z")

</div>

> [@summguy](#):
>
> why is a new instance window of the IDE opened instead of adding a new tab to the current instance

The reason is that a sketch may contain multiple files. The code from all the files of the sketch is compiled, and that compiled program uploaded to the Arduino board. If multiple sketches were opened in a single Arduino IDE window, it would become difficult to understand exactly what code is being compiled. This would result in two types of confusion:

- Users who think the IDE will magically merge the multiple sketches together and upload the amalgam.
- Users who think the IDE is only compiling and uploading the code from the specific file they have selected, rather than all files of that sketch.

The benefit of Arduino IDE's window-per-sketch design might not be obvious if you have only worked with sketches that consist of a single file, but the Arduino IDE design must accommodate multi-file sketches.

> [@summguy](#):
>
> I guess opening a new instance of the IDE is necessary or expected behavior.

It is certainly technically possible to design an Arduino IDE application so that it supports having multiple sketches open in the same window. So "necessary" is not the right way to describe it, but "expected" is. This is the intentional design of Arduino IDE, with the goal of making sketch development intuitive.

> [@summguy](#):
>
> I don’t know why that .h file is occupying the second tab

Arduino IDE creates a tab for each of the code files in the root of the sketch folder.

> [@summguy](#):
>
> does it have to be?

For `.h` files in the root of the sketch folder, yes.

If your sketch has supplemental files that you don't wish to have open as tabs by default, you can move them under [a subfolder of the sketch named `src`](https://arduino.github.io/arduino-cli/latest/sketch-specification/#src-subfolder).

You can organize the files in any arbitrary subfolder structure you like under that `src` subfolder. Arduino IDE compiles the contents of the `src` subfolder of the sketch recursively.

Arduino IDE automatically opens all the sketch code files present the root of the sketch when you open the sketch. It does not do this for the files in the subfolders. You can open an close those files on demand. I'll provide instructions you can follow to open a sketch code file from a subfolder of the sketch:

1. Select **File \> Preferences...** (or **Arduino IDE \> Settings...** for macOS users) from the Arduino IDE menus.  
The " **Preferences**" dialog will open.
2. Check the box next to " **Show files inside Sketches**" in the " **Preferences**" dialog.
3. Click the " **OK**" button.  
The " **Preferences**" dialog will close.
4. Click the folder icon in the activity bar on the left side of the IDE window to open the " **SKETCHBOOK**" view.
5. You will see a listing of the contents of your sketchbook folder. Click the **❯** icons to the left of the relevant entries to navigate to a code file from the current sketch that you want to open.
6. Click on the file in the " **SKETCHBOOK**" view.

The file will open in a new editor tab. You can browse and edit the contents as needed. When you no longer need the tab, click the **X** icon on the tab to close it.

> [@summguy](#):
>
> How do you close a tab?

It is not possible to close the tabs for the files in the root of the sketch folder that open by default in the Arduino IDE editor. The reason for this design is that new users could get confused by the fact that Arduino IDE is compiling and uploading code from files they don't even see in Arduino IDE. By showing tabs for the primary sketch code files, and only those files, Arduino IDE intuitively communicates which code will be compiled and uploaded to the user.

---

<div class="post-metadata">

**Author:** ![JohnRob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnrob/32/253560_2.png) [@JohnRob](https://forum.arduino.cc/u/JohnRob)\
**Post date:** [August 11, 2025, 5:14am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/20 "2025-08-11T05:14:28Z")

</div>

The tabs on the top are not multiple sketches. They are external files for the current project. A single arduino ide instance can only have one sketch.

These external files are only the ones that are referenced in your program but not the ones in a library.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [August 11, 2025, 11:34am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/21 "2025-08-11T11:34:12Z")

</div>

That is also a strategy.

---

<div class="post-metadata">

**Author:** ![tigger](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tigger/32/1104210_2.png) [@tigger](https://forum.arduino.cc/u/tigger)\
**Post date:** [August 11, 2025, 11:40am UTC](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408/22 "2025-08-11T11:40:05Z")

</div>

Go ahead and ask.

Functions aren't a bad start.

[Next page](https://forum.arduino.cc/t/maybe-a-stupid-question/1401408.md?page=2)
