[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why CXX defaults to g++ instead of c++
From: |
Paul Smith |
Subject: |
Re: Why CXX defaults to g++ instead of c++ |
Date: |
Wed, 27 Jul 2016 11:26:33 -0400 |
On Wed, 2016-07-27 at 21:39 +0800, Lei Zhang wrote:
> The problem is, somehow Make defaults CXX to g++ instead of c++, so
> my solution doesn't work. While CC already defaults to cc, is there
> any specific reason for CXX not to default to c++?
The POSIX spec defines that "cc" be a C compiler, and that the CC make
macro be set to it (actually the newer POSIX specs require it be set to
"c99"; that should be fixed in GNU make).
There's no requirement for a C++ compiler on a POSIX system, and no
default setting for the CXX variable (in fact that variable isn't
defined in POSIX).
So, make just uses "g++" by default. I seem to recall that back in the
early days of GCC, there was no "c++" installed and only "g++".
If you want a specific C++ compiler, you should set CXX to that value.