[Bug c++/67195] cpp and g++ does not define __GLIBCXX__

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 13 09:08:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67195

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Jeffrey Walton from comment #2)
> > > 
> > > $ 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?
> 
> I think the document assumes that since this is the library docs rather than
> the compiler or preprocessor doc n
> 

Actually it is right in the second paragraph:
Furthermore, all pre-processor macros, switches, and configuration options are
gathered in the file c++config.h

What more is needed?


> 
> 
> > 
> > ------
> > 
> > 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"?



More information about the Gcc-bugs mailing list