I was trying to convert syntax of old Swift project to new one as per few suggestion on Stack Overflow I tried converting it through Edit > Convert > To latest Synta
In my case, it was "Other swift flags". I had declared a flag there but not -D, so this was not getting recognized and resulted in the same error