Error: macro name must be an identifier

I’m hitting this error and finding it very hard to work out what caused it.
This is a CMake project building on macOS 13.4

The project version is set to “0.1.0”. I’m not sure if that is a red herring or a clue.

In file included from <built-in>:485:
<command line>:1:9: error: macro name must be an identifier
#define 0.1.0 1
1 error generated.

@reuk any clues or things I can try to debug or solve it?

That flag, passed to the compiler, will be the problem. I’m not sure where that could be coming from. The first thing I’d check is that the version is set in juce_add_plugin or equivalent, instead of target_compile_definitions.

Yes, my assumption also.

The version is set in the CMake project command. However I get the same issue if I set it in juce_add_gui_app.

No version is set in target_compile_definitions

target_compile_definitions was a clue. It seems that clang-format added a space in front of these definitions which I think caused the issue.


Fixed now thank you.


Yep, I was struggling with this a week or so back. No spaces around the equal sign!

A direct contravention of the JUCE coding style guide :grin:

1 Like

Thanks Adam, this just saved my butt. Shakes fist at CLion