Hjkl
Hjkl

Reputation: 59

Function definition not found for #define

I am getting a weird error for one of my macros. The names are changed, but besides that the code is exactly the same as the one in my project. Its purpose is automatic a process I write many times troughout my code.

#ifdef add
#undef add
#endif
#define add(name, temp)             \
struct name<temp>                   \
{                                   \
    static constexpr r = true;      \
}

Here is the error:

Function definition for 'add' not found.

explicit type is missing ('int' assumed)

It's expanding the code properly and showing me that too, but it seems either it is very confused about what's going on or I do not understand the error.

I am using Visual Studio 2019, so the VC++19 compiler.

Upvotes: 1

Views: 1154

Answers (1)

asmmo
asmmo

Reputation: 7100

I think you've forgotten bool keyword as compiler message suggested but as int

#ifdef add
#undef add
#endif
#define add(name, temp)             \
struct name<temp>                   \
{                                   \
    static constexpr bool r = true;      \
}

Upvotes: 2

Related Questions