I am trying to write software that can behave differently based on whether or not a certain component should be simulated in software or execute on real hardware. However, GCC complains that the Scope resolution operator (::) cannot be used in a macro, so my question is: is it possible to define a macro to a static method call?

My goal is to be able to, using another preprocessor define, choose between using all real components (0), using all simulated components (1), or using a mix of real and simulated components (2). This last case is where I am running into this issue. Under this condition, I want to call a function which I am "protecting" by implementing it as a static method. Here is my approach:

```
#define SIM_CONF 2

#if SIM_CONF == 0
#define IS_HW_SIMULATED(name) false
#define IS_HW_REAL(name) true
#endif

#if SIM_CONF == 1
#define IS_HW_SIMULATED(name) true
#define IS_HW_REAL(name) false
#endif

#if SIM_CONF == 2
#define IS_HW_SIMULATED(name) SimConfig::isSimulated(name)
#define IS_HW_REAL(name) SimConfig::isReal(name)
#endif

class SimConfig
{
public:

    static bool isSimulated(const char* szName);
    static bool isReal(const char* szName);
};

```

**EDIT:** Here's an example of how I use it elsewhere:

```
void PumpComponent::commandRevs(float revs)
{
#if IS_HW_SIMULATED("PumpComponent")
    // do simulation procedure
#else
    // do real hardware procedure
#endif
}

```

When I compile, GNU Make complains:

> 
> 
> ```
> error: token "::" is not valid in preprocessor expressions
> #define IS_HW_SIMULATED(name) SimConfig::isSimulated(name)
> 
> ```
> 
> 

Is there some approach where I can protect/encapsulate the `isSimulated()` and `isReal()` functions, and still be able to refer to them in preprocessor directives?