From b166534b5b2c7b79a1cb36fa08a6258f49876197 Mon Sep 17 00:00:00 2001 From: Renat0Ribeir0 Date: Tue, 3 Sep 2024 09:50:52 +0200 Subject: [PATCH 1/3] Update If-your-sketch-doesnt-compile.md --- .../If-your-sketch-doesnt-compile.md | 61 +++++++++++-------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md b/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md index 98f77fc9..a3ce3580 100644 --- a/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md +++ b/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md @@ -5,12 +5,22 @@ id: 4402764401554 Learn about compilation errors in your sketch and how to resolve them. +In this article: + +* [Quick checks](#quick-checks) +* [How to interpret an error message](#how-to-interpret-an-error-message) +* [Troubleshoot a specific error](#troubleshoot-a-specific-error) + --- + + ## Quick checks * Make sure your error occurs during compilation by clicking ![Verify button](img/symbol_verify2.png) **Verify** instead of ![Upload button](img/symbol_upload2.png) **Upload**. This will compile the sketch without attempting to upload it. If your error only occurs when uploading, see [Errors when uploading a sketch](https://support.arduino.cc/hc/en-us/articles/4403365313810-Errors-when-uploading-a-sketch). +* Make sure you have the right board selected in the board selector or the _Tools > Board_ menu. See [Select board and port in Arduino IDE](https://support.arduino.cc/hc/en-us/articles/4406856349970-Select-board-and-port-in-Arduino-IDE) for more information. + * A successful compilation will always finish with this message (the storage space and memory values might differ depending on the board used): ``` @@ -20,41 +30,44 @@ Learn about compilation errors in your sketch and how to resolve them. * A sketch always needs to include a `setup()` and `loop()` function, even if they're not being used. You can use _File > Examples > 1.Basics > BareMinimum_ as a template. -* Libraries added with `#include` need to be installed. Try searching for the library name in the Library Manager (_Tools > Manage Libraries..._). +* Libraries added with `#include` need to be installed. Learn how to [add libraries to Arduino IDE](https://support.arduino.cc/hc/en-us/articles/5145457742236-Add-libraries-to-Arduino-IDE). --- -## Interpreting the error message + + +## How to interpret an error message + +To get more information about the error, we need to check the console output. See the example below: + +1. If a pop-up notification is still showing, close it by clicking the **x** in the top-right corner. -Arduino IDE displays compilation messages differently depending on the version: + ![Closing the pop-up notification.](img/ide-compilation-error-exit-status-1-x.png) -1. Check the IDE error message. - * In IDE 1.x, it is displayed above the console window. - * In IDE 2, it is displayed in a bottom-right pop-up. - Sometimes, preceding lines can be more informative — check the console output. +2. Find the console output panel. -2. Check the console output. - * Compilation errors will often reference the row and column where the error was triggered, i.g. `Blink:29:1` (line 29, 1 column). - * You may have to scroll or expand the window width to see the entire message. + ![The error output in the console panel.](img/ide-compilation-error-exit-status-1-1.png) -3. Look for highlights in the editor: - * In IDE 1.x, the **line** where the error occurred is highlighted in red. - * In IDE 2, the **character** where the error occurred is underlined in red. - * The line causing the error may be before the line where it was triggered. In the example above, line 28 is missing a semicolon (`;`), but the error will be triggered by the unexpected closing bracket (`}`) in line 29. +3. Read the first few lines. The following generic messages may appear near the end of the output: - - - - - - - - - -
Compilation error in IDE 1.8.13, due to a missing semicolon.Compilation error in IDE 2.0.0-3c6, due to a missing semicolon.
Error output in IDE 1.x.Error output in IDE 2.
+ * `collect2: error: ld returned 1 exit status` + * `exit status 1` + * `Compilation error: exit status 1` + + These generic error messages indicate that the compilation process failed but don't provide specific details about the error, so it's important to read the lines before them. + +4. Look for lines starting with file paths. At this point, you may need to resize the window or scroll to the right to reveal the full lines. These files will often be pointing at `main.cpp` function, or a temporary copy of your sketch. + +5. In this example, the message ...main.ccp:43: undefined reference to \`setup' is the most informative: + + ![Scrolling right in the console panel to reveal more output.](img/ide-compilation-error-exit-status-1-2.png) + + In this case, the error was caused by a missing `setup()` function. --- + + ## Troubleshoot a specific error From 9e8d006b6597b8c9465537ae05cc22bae68757d0 Mon Sep 17 00:00:00 2001 From: Renat0Ribeir0 Date: Tue, 3 Sep 2024 11:52:09 +0200 Subject: [PATCH 2/3] Delete Compilation-error-exit-status-1.md --- .../Compilation-error-exit-status-1.md | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 content/Software Support/Compilation/Compilation-error-exit-status-1.md diff --git a/content/Software Support/Compilation/Compilation-error-exit-status-1.md b/content/Software Support/Compilation/Compilation-error-exit-status-1.md deleted file mode 100644 index 468a5827..00000000 --- a/content/Software Support/Compilation/Compilation-error-exit-status-1.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: "Compilation error: exit status 1" -id: 6554914611228 ---- - -When you verify or upload a sketch, the error `Compilation error: exit status 1` may appear in the console and in a pop-up notification. - -> [!NOTE] -> For other compilation errors, see [If your sketch doesn't compile](https://support.arduino.cc/hc/en-us/articles/4402764401554-If-your-sketch-doesn-t-compile). - ---- - -## Quick checks - -1. Make sure you have the right board selected in the board selector or the _Tools > Board_ menu. See [Select board and port in Arduino IDE](https://support.arduino.cc/hc/en-us/articles/4406856349970-Select-board-and-port-in-Arduino-IDE) for more information. - -2. Make sure you've declared `setup()` and `void()` functions in your sketch, even if they're not being used: - - ```arduino - void setup() { - // put your setup code here, to run once: - - } - - void loop() { - // put your main code here, to run repeatedly: - - } - ``` - -3. Check for missing, outdated, or conflicting libraries in the [console output](#console-output). - ---- - - - -## Check the console output for more information - -To get more information about the error, we need to check the console output: - -1. If a pop-up notification is still showing, close it by clicking the **x** in the top-right corner. - - ![Closing the pop-up notification.](img/ide-compilation-error-exit-status-1-x.png) - -2. Find the console output panel. - - ![The error output in the console panel.](img/ide-compilation-error-exit-status-1-1.png) - -3. Read the first few lines. Often, a `Compilation error: exit status 1` error message will be preceded by other, similar sounding messages such as: - - * `collect2: error: ld returned 1 exit status` - * `exit status 1` - - Since these are also generic error messages, continue reading. - -4. Look for lines starting with file paths. At this point, you may need to resize the window or scroll to the right to reveal the full lines. These files will often be pointing at `main.cpp` function, or a temporary copy of your sketch. - -5. In this example, the message ...main.ccp:43: undefined reference to \`setup' is the most informative: - - ![Scrolling right in the console panel to reveal more output.](img/ide-compilation-error-exit-status-1-2.png) - - In this case, the error was caused by a missing `setup()` function. - ---- - -## If you still need help - -* Arduino sketches are written in the Arduino language, which is based on standard C++ language. Most likely you will find a wealth of resources by searching `C++ ` in your search engine. - -* For help with functions specific to Arduino, see the [Arduino functions reference](https://www.arduino.cc/reference/en/). - -* Visit the [Programming Questions category](https://forum.arduino.cc/c/20) in the Arduino forum. Start by reading the pinned threads which will contain useful information on how to best post a question. - -* See [Troubleshooting Guide For Arduino > Compiling](https://per1234.github.io/ino-troubleshooting/compiling.html). - -* [Contact us](https://wiki-content.arduino.cc/en/contact-us/). From f53571103ed3bb1aa3a5c6df59e061efc8ec07da Mon Sep 17 00:00:00 2001 From: Renat0Ribeir0 Date: Tue, 3 Sep 2024 12:09:29 +0200 Subject: [PATCH 3/3] add link to error --- .../Compilation/If-your-sketch-doesnt-compile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md b/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md index a3ce3580..f09c6f0e 100644 --- a/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md +++ b/content/Software Support/Compilation/If-your-sketch-doesnt-compile.md @@ -62,7 +62,7 @@ To get more information about the error, we need to check the console output. Se ![Scrolling right in the console panel to reveal more output.](img/ide-compilation-error-exit-status-1-2.png) - In this case, the error was caused by a missing `setup()` function. + In this case, the error was caused by a [missing `setup()` function](#required-functions). ---