Archive 17/01/2023.

#elif not compiling in GLSL

Bananaft

So i have:

#ifdef PARAM_1

#elif PARAM_2

#else

#endif

I’m getting compile error: “Syntax error in #if” as soon as I’m setting PARAM_2
But this:

#ifdef PARAM_1

#else
#ifdef PARAM_2

#else

#endif
#endif

works fine with no errors.

Is it a bug? Or just something Urho does or does not?

I’d like to have #elif to work, because I going to have many such params.

1vanK

try #elif defined(…)

p.s. #ifdef is equivalent to #if defined (not just #if), so #elif can not be part of #ifdef#endif