Difference between CPPFLAGS and CXXFLAGS in GNU Make

前端 未结 4 376
面向向阳花
面向向阳花 2020-11-28 18:37

What\'s the difference between CPPFLAGS and CXXFLAGS in GNU Make?

相关标签:
4条回答
  • 2020-11-28 19:03

    By default, they're set to something.

    In practice, you need to know what every single project does. Virtually no one uses those defaults built into make, and if you rely on, for example, CPPFLAGS meaning "flags to the C preprocessor" you'll find that the project you care about has used it to mean "flags to the C++ compiler" instead. And does the CFLAGS flag get passed to C++ compile lines? Sometimes. Not always. Etc, etc, etc.

    0 讨论(0)
  • CPPFLAGS are for the C preprocessor, while CXXFLAGS are for the C++ compiler.

    See here.

    0 讨论(0)
  • 2020-11-28 19:24

    By default, CPPFLAGS will be given to the C preprocessor, while CXXFLAGS will be given to the C++ compiler.

    The GNU Make Manual is a good resource for questions like this (see Implicit Variables).

    0 讨论(0)
  • 2020-11-28 19:29

    CPPFLAGS is supposed to be for flags for the C PreProcessor; CXXFLAGS is for flags for the C++ compiler.

    The default rules in make (on my machine, at any rate) pass CPPFLAGS to just about everything, CFLAGS is only passed when compiling and linking C, and CXXFLAGS is only passed when compiling and linking C++.

    0 讨论(0)
提交回复
热议问题