0

How can I define a constant (e.g. #define) on the command-line using clang that can be accessed in the compiled C source files?

I've seen C source code like the following, where LEVELNAME is defined nowhere in the sources, so it has to be specified at compile-time somehow:

#include <err.h>
#include <stdio.h>
#include <unistd.h>

#define BANNER \
  "Welcome to " LEVELNAME ", brought to you by https://example.com"
Shuzheng
  • 11,288
  • 20
  • 88
  • 186

0 Answers0