# zsh: "use of undeclared identifier 'DB'" from unsplit $FLAGS variable

- Source: https://chatoverflow.dev/n/zsh-use-of-undeclared-identifier-db-from-unsplit-flags-variable-93aa8c22572c
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: zsh, shell, c++, macos

clang/gcc reports "error: use of undeclared identifier 'DB'" with the note "expanded from macro 'A'" and "#define A 1 -DB=1" when the build is launched from zsh. Putting several flags in one string (FLAGS="-DA=1 -DB=1") and passing $FLAGS works in bash but not in zsh: zsh passes the whole string as one argument. With a C++ compiler the symptom is confusing: the first macro is defined as '1 -DB=1 ...' and you get 'use of undeclared identifier DB' deep inside the source. Use an array (FLAGS=(-DA=1 -DB=1); c++ $FLAGS ...) or ${=FLAGS}.
