<p>The compiler can't see the definition of <code>MM_PER_ARC_SEGMENT</code>. Find the file that it is declared in and ensure that file in included in the compile command, as an include (<code>#include</code>) or path or whatever.</p>
<p>Looking at the current <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h" rel="nofollow noreferrer"><code>Configuration_adv.h</code></a> on the Marlin Github repository, the definition is at <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h#L2033" rel="nofollow noreferrer">Line 2033</a> in the section at Lines <a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h#L2028" rel="nofollow noreferrer">2028</a>-2041</p>
<pre><code>//
// G2/G3 Arc Support
//
#define ARC_SUPPORT                 // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
  #define MM_PER_ARC_SEGMENT      1 // (mm) Length (or minimum length) of each arc segment
  //#define ARC_SEGMENTS_PER_R    1 // Max segment length, MM_PER = Min
  #define MIN_ARC_SEGMENTS       24 // Minimum number of segments in a complete circle
  //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
  #define N_ARC_CORRECTION       25 // Number of interpolated segments between corrections
  //#define ARC_P_CIRCLES           // Enable the 'P' parameter to specify complete circles
  //#define CNC_WORKSPACE_PLANES    // Allow G2/G3 to operate in XY, ZX, or YZ planes
  //#define SF_ARC_FIX              // Enable only if using SkeinForge with &quot;Arc Point&quot; fillet procedure
#endif
</code></pre>
<p>Ensure that you have <code>ARC_SUPPORT</code> enabled - do not have the following line (<a href="https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/Configuration_adv.h#L2031" rel="nofollow noreferrer">2031</a>) commented out:</p>
<pre><code>#define ARC_SUPPORT 
</code></pre>

CC BY-SA 4.0
2021-09-21T09:14:38.067Z
2021-09-21T15:18:19.477Z
2021-09-21T15:18:19.477Z
Greenonline
<p>I have a Tronxy X5SA printer upon which I want to install the latest Marlin firmware v2.0.9.1.</p>
<p>I take the configuration example on GitHub for the X5SA printer and modify the lines in <code>configuration.h</code> as recommended in the guide (see <a href="https://github.com/MarlinFirmware/Configurations/blob/import-2.0.x/config/examples/Tronxy/X5SA/HOWTO-INSTALL.md" rel="nofollow noreferrer">this URL</a>).</p>
<p>In Visual Studio Code, when I compile, I obtain this error :</p>
<pre><code>Marlin\src\gcode\motion\G2_G3.cpp: In function 'void plan_arc(const xyze_pos_t&amp;, const ab_float_t&amp;, bool, uint8_t)':
Marlin\src\gcode\motion\G2_G3.cpp:154:7: error: 'MM_PER_ARC_SEGMENT' was not declared in this scope
       MM_PER_ARC_SEGMENT
       ^~~~~~~~~~~~~~~~~~
Marlin\src\gcode\motion\G2_G3.cpp:154:7: note: suggested alternative: 'MAX_ARC_SEGMENT_MM'
       ^~~~~~~~~~~~~~~~~~
       MAX_ARC_SEGMENT_MM
Compiling .pio\build\chitu_f103\src\src\gcode\sd\M20.cpp.o
*** [.pio\build\chitu_f103\src\src\gcode\motion\G2_G3.cpp.o] Error 1
========================================================================================= [FAILED] Took 71.95 seconds ========================================================================================= 

Environment    Status    Duration
-------------  --------  ------------
chitu_f103     FAILED    00:01:11.945
==================================================================================== 1 failed, 0 succeeded in 00:01:11.945 ==================================================================================== 
PS D:\TRONXY\Marlin-2.0.9.1\Marlin-2.0.9.1&gt; echo &quot;done&quot; &gt;C:\Users\myUser\AppData\Local\Temp\ipc
PS D:\TRONXY\Marlin-2.0.9.1\Marlin-2.0.9.1&gt; 
</code></pre>
<p>Here is the code in <code>G2_G3.cpp</code> on line 154, but I need some help to understand why it's wrong, and how to fix...</p>
<pre><code> // Start with a nominal segment length
  float seg_length = (
    #ifdef ARC_SEGMENTS_PER_R
      constrain(MM_PER_ARC_SEGMENT * radius, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R)
    #elif ARC_SEGMENTS_PER_SEC
      _MAX(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MM_PER_ARC_SEGMENT)
    #else
      MM_PER_ARC_SEGMENT // LINE 154 HERE!!
    #endif
  );
  // Divide total travel by nominal segment length
  uint16_t segments = FLOOR(mm_of_travel / seg_length);
  NOLESS(segments, min_segments);         // At least some segments
  seg_length = mm_of_travel / segments;
</code></pre>
<p>I have tried to compile the BugFix version successfully, but unfortunately the bugfix version does not work properly with my printer (I can't get the bed to lift to the probe. I have opened <a href="https://3dprinting.stackexchange.com/questions/18073/tronxy-x5sa-not-working-properly-after-marlin-firmware-installation">another post</a> for the bugfix version issue).</p>

<marlin><firmware><tronxy><tronxy-x5sa>
Marlin firmware 2.0.9.1 for X5SA example : MM_PER_ARC_SEGMENT Compilation Error
Julo0sS
# Marlin firmware 2.0.9.1 for X5SA example : MM_PER_ARC_SEGMENT Compilation Error

(Asked by: username_0 on 2021-09-19)

I have a Tronxy X5SA printer upon which I want to install the latest Marlin firmware v2.0.9.1.
I take the configuration example on GitHub for the X5SA printer and modify the lines in configuration.h as recommended in the guide (see this URL).
In Visual Studio Code, when I compile, I obtain this error :
Marlin\src\gcode\motion\G2_G3.cpp: In function 'void plan_arc(const xyze_pos_t&, const ab_float_t&, bool, uint8_t)':
Marlin\src\gcode\motion\G2_G3.cpp:154:7: error: 'MM_PER_ARC_SEGMENT' was not declared in this scope
       MM_PER_ARC_SEGMENT
       ^~~~~~~~~~~~~~~~~~
Marlin\src\gcode\motion\G2_G3.cpp:154:7: note: suggested alternative: 'MAX_ARC_SEGMENT_MM'
       ^~~~~~~~~~~~~~~~~~
       MAX_ARC_SEGMENT_MM
Compiling .pio\build\chitu_f103\src\src\gcode\sd\M20.cpp.o
*** [.pio\build\chitu_f103\src\src\gcode\motion\G2_G3.cpp.o] Error 1
========================================================================================= [FAILED] Took 71.95 seconds ========================================================================================= 

Environment    Status    Duration
-------------  --------  ------------
chitu_f103     FAILED    00:01:11.945
==================================================================================== 1 failed, 0 succeeded in 00:01:11.945 ==================================================================================== 
PS D:\TRONXY\Marlin-2.0.9.1\Marlin-2.0.9.1> echo "done" >C:\Users\myUser\AppData\Local\Temp\ipc
PS D:\TRONXY\Marlin-2.0.9.1\Marlin-2.0.9.1> 

Here is the code in G2_G3.cpp on line 154, but I need some help to understand why it's wrong, and how to fix...
 // Start with a nominal segment length
  float seg_length = (
    #ifdef ARC_SEGMENTS_PER_R
      constrain(MM_PER_ARC_SEGMENT * radius, MM_PER_ARC_SEGMENT, ARC_SEGMENTS_PER_R)
    #elif ARC_SEGMENTS_PER_SEC
      _MAX(scaled_fr_mm_s * RECIPROCAL(ARC_SEGMENTS_PER_SEC), MM_PER_ARC_SEGMENT)
    #else
      MM_PER_ARC_SEGMENT // LINE 154 HERE!!
    #endif
  );
  // Divide total travel by nominal segment length
  uint16_t segments = FLOOR(mm_of_travel / seg_length);
  NOLESS(segments, min_segments);         // At least some segments
  seg_length = mm_of_travel / segments;

I have tried to compile the BugFix version successfully, but unfortunately the bugfix version does not work properly with my printer (I can't get the bed to lift to the probe. I have opened another post for the bugfix version issue).

**Tags:** marlin, firmware, tronxy, tronxy-x5sa

---

## 1 answers

### Answer by username_1 on 2021-09-21. Score: 1 | Accepted answer

The compiler can't see the definition of MM_PER_ARC_SEGMENT. Find the file that it is declared in and ensure that file in included in the compile command, as an include (#include) or path or whatever.
Looking at the current Configuration_adv.h on the Marlin Github repository, the definition is at Line 2033 in the section at Lines 2028-2041
//
// G2/G3 Arc Support
//
#define ARC_SUPPORT                 // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
  #define MM_PER_ARC_SEGMENT      1 // (mm) Length (or minimum length) of each arc segment
  //#define ARC_SEGMENTS_PER_R    1 // Max segment length, MM_PER = Min
  #define MIN_ARC_SEGMENTS       24 // Minimum number of segments in a complete circle
  //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
  #define N_ARC_CORRECTION       25 // Number of interpolated segments between corrections
  //#define ARC_P_CIRCLES           // Enable the 'P' parameter to specify complete circles
  //#define CNC_WORKSPACE_PLANES    // Allow G2/G3 to operate in XY, ZX, or YZ planes
  //#define SF_ARC_FIX              // Enable only if using SkeinForge with "Arc Point" fillet procedure
#endif

Ensure that you have ARC_SUPPORT enabled - do not have the following line (2031) commented out:
#define ARC_SUPPORT


---

