Coding ERROR compiling MARLIN 2.0

CODE:
error: missing binary operator before token "("
#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)
^

Is Arduino IDE able to handle this "If EITHER(..."??
..and why NOT?

We can't see your code.

Please don't forget the code tags.

That depends on how the macro 'EITHER' is defined. I found it in Marlin/src/core/macros.h and it compiles without error for me.

// Macros to support option testing
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
#define SECOND(a,b,...)  b
#define _CAT(a,V...) a##V
#define CAT(a,V...) _CAT(a,V)
#define IS_PROBE(V...) SECOND(V, 0)     // Get the second item passed, or 0
#define PROBE() ~, 1                    // Second item will be 1 if this is passed
#define _NOT_0 PROBE()
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
#define _ISENA_     ~,1
#define _ISENA_1    ~,1
#define _ISENA_0x1  ~,1
#define _ISENA_true ~,1
#define _ISENA(V...)        IS_PROBE(V)
#define _ENA_1(O)           _ISENA(CAT(_IS,CAT(ENA_, O)))
#define _DIS_1(O)           NOT(_ENA_1(O))
#define _DO_2(W,C,A,B)     (_##W##_1(A) C _##W##_1(B))
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
#define _DO_N(W,C,N,V...)  __DO_N(W,C,N,V)

// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
#define _NUM_ARGS(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
#define NUM_ARGS(V...) _NUM_ARGS(0,V,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)

#define DO(W,C,V...)       (_DO_N(W,C,NUM_ARGS(V),V))
#define DISABLED(V...)      DO(DIS,&&,V)
#define ANY(V...)          !DISABLED(V)
#define EITHER(V1,V2)       ANY(V1,V2)

#define PARKING_EXTRUDER 0
#define MAGNETIC_PARKING_EXTRUDER 1

#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)

#endif

void setup() {}
void loop() {}

.. and you are using ARDUINO IDE?

I looked in my version of MACROS.h and it do not look like yours, so have to find another version.

BUT... Thanks anyway...

Which specific version of Marlin are you compiling, which version of the Arduino IDE, which operation system, and for which 3D printer? Preferably post a link to the Configuration.h and Configuration_adv.h files if you downloaded them.

I just included the declaration of the EITHER() macro, not the whole file. Using the whole file, this compiles without error:

Arduino: 1.8.13 (Mac OS X), Board: "Arduino Uno"

#include "macros.h"

#define PARKING_EXTRUDER 0
#define MAGNETIC_PARKING_EXTRUDER 1

#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)

#endif

void setup() {}
void loop() {}

I found the right file, so now my problem is gone... Thanks to you johnwasser

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