0

Is it possible to use the libstdc++ from gcc on OS X? Do I have to download the full version of gcc or the LLVM is good? What are the headers to #include?

Jonathan Wakely
  • 153,269
  • 21
  • 303
  • 482
fpiro07
  • 817
  • 1
  • 11
  • 18
  • Not an answer, but just out of curiosity, what (from libstdc++) are you missing in LLVM's standard library? – Joachim Isaksson Dec 31 '12 at 14:39
  • I don't even know whether I'm missing anything, I'm just asking because I don't know anything about that library, not even the headers... – fpiro07 Dec 31 '12 at 14:40
  • 1
    @fpiro07 Firstly, the "With Xcode" part of the question doesn't make sense, these have nothing to do with Xcode. Two, when you download the developer tools, all necessary frameworks, libraries and headers, including the C and C++ standard libraries, get installed and they're ready to use. Also, why the "DLL" tag? This is not Windows, right? What do you mean by "the full version of GCC or LLVM is good"? Do you think that LLVM is a stripped-down version of GCC? So much wrong assumptions, please try to inform yourself to at least an acceptable level. –  Dec 31 '12 at 14:48
  • Yeah, I thought that the LLVM version was a stripped-down version and I was wrong. Sorry for my low level but I am a newbie and if I write here I obviously want to learn something otherwise I wouldn't write. Can you please give me an answer now? – fpiro07 Dec 31 '12 at 14:54
  • @fpiro07 I've already done that. You don't need anything special in order to use the C and C++ standard libraries. –  Dec 31 '12 at 14:57
  • But why do I get an error if I write `#include `? (I have to use the decimal types) – fpiro07 Dec 31 '12 at 15:00
  • @fpiro07 You simply `#include `. –  Dec 31 '12 at 15:14
  • It can't find it... Maybe that's because I have a too old version of GCC? How can I update it? – fpiro07 Dec 31 '12 at 16:15
  • @fpiro07 Exact error message **and** compiler invocation please. –  Dec 31 '12 at 17:26
  • The version of GCC included with Xcode on Mac OS X is 4.2, the C++ Decimal extensions (including the `` header) were added to GCC 4.5, so you need a newer version. – Jonathan Wakely Dec 31 '12 at 18:51
  • 1
    @H2CO3, no, it's `#include `. – Jonathan Wakely Dec 31 '12 at 18:51
  • @JonathanWakely Thanks, do you also know how to update GCC in XCode? – fpiro07 Dec 31 '12 at 18:53
  • 1
    No, but you need to install a newer GCC (e.g. from Macports of fink or something) then change the compiler paths in Xcode to use the new version, but I have no idea how to do that. – Jonathan Wakely Dec 31 '12 at 18:56

1 Answers1

3

Judging from your previous question and comments you are interested in the Decimal extensions included in libstdc++, not just libstdc++ itself.

You can easily use libstdc++ and/or GCC on OS X, they should be included with Xcode, but only a very old version, GCC 4.2, which doesn't include the Decimal extensions that you're interested in.

To use those extensions you'll need to install GCC 4.5 or later and use that instead of the default clang or gcc-4.2 compilers.

Community
  • 1
  • 1
Jonathan Wakely
  • 153,269
  • 21
  • 303
  • 482