[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make can not find .cpp file, any general comments or suggestions to

From: Greg Chicares
Subject: Re: make can not find .cpp file, any general comments or suggestions to debug?
Date: Wed, 03 May 2006 13:58:22 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2006-5-3 12:42 UTC, Lin George wrote:
> I have read through the section you recommended, but I
> can not find the relationship between CXXFLAGS and
> CPPFLAGS (for example, CXXFLAGS includes CPPFLAGS) --

$(CXXFLAGS) doesn't "include" $(CPPFLAGS). They're distinct.

The convention is to use them both together for C++. To build a C++
program, traditionally at least three tools are needed, and each has
its own flags for flexibility and clarity:
  $(CPPFLAGS) for $(CPP), the C preprocessor
  $(CXXFLAGS) for $(CXX), the C++ compiler
  $(LDFLAGS)  for $(LD),  the linker

10.2 Catalogue of Implicit Rules
| Compiling C++ programs
|   n.o is made automatically from, n.cpp, or n.C with a command
|   of the form `$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)'.

> to my surprise, instead I found that CPPFLAGS is used
> for C (not C++)?

C++ uses the C preprocessor. That's part of the language's definition.

14.3 Variables for Specifying Commands
| Use CPPFLAGS in any compilation command that runs the preprocessor

> Here is the original text from GNU
> make manual,
> --------------------
> CXXFLAGS Extra flags to give to the C++ compiler.
> CPPFLAGS Extra flags to give to the C preprocessor and
> programs that use it (the C and
> Fortran compilers).
> --------------------

Read the parenthetical statement as:
  (for example, the C, C++, and Fortran compilers)

I'm not sure it's possible to list every language that uses the C
preprocessor, though. Perhaps "Objective C" does; I wouldn't know.
How about Walter Bright's "D" language? Or "C with Classes"?
Or "B"? Or "BCPL"?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]