This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67195] cpp and g++ does not define __GLIBCXX__
- From: "noloader at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Aug 2015 08:42:48 +0000
- Subject: [Bug c++/67195] cpp and g++ does not define __GLIBCXX__
- Auto-submitted: auto-generated
- References: <bug-67195-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67195
--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> ---
>
> $ uname -a
> Linux localhost.localdomain 4.1.3-201.fc22.x86_64 #1 SMP Wed Jul 29 19:50:22
> UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
>
> $ g++ --version
> g++ (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)
> Copyright (C) 2015 Free Software Foundation, Inc
(In reply to Jonathan Wakely from comment #1)
> The library macro is defined by the library, not the compiler. You didn't
> include any library headers.
Thanks Jonathon.
The documentation does not state that requirement. Perhaps this is a
documentation bug?
------
Related, here's how I am trying to use it in a makefile:
USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E -dM - </dev/null | $(EGREP) -i
-c "__GLIBCXX__")
$(info USING_GLIBCXX: $(USING_GLIBCXX))
# For debug builds
ifneq ($(USING_GLIBCXX),0)
CXXFLAGS += -D_GLIBCXX_DEBUG=1 --enable-concept-checks
endif
CXX and CXXFAGS are populated, and they hold the settings that will be used by
make to compile the source code. It kind of begs the question, how does CXX
know to use -stdlib=libstdc++ if its not specified in CXXFLAGS? Shouldn't
everything "just work" or everything "just fail"?