Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
How may I compile a C++ program under the C++11 standard in Ubuntu 11.04 with the most up-to-date compiler, at best using compiler from the distribution, i.e., pre-built package.
GCC 4.6 provides most of the C++11 features. One has only to add the flag -std=c++0x and can use range based for loops, strong enums, UTF strings, etc. For the list of features available in a given version of GCC one can check on http://gcc.gnu.org/projects/cxx0x.html.
Update in 2017: It seem GCC 7 and higher has full C++ 2011 compliance. The rest of the answer below was written in the GCC 4.7 era, and was correct when written in 2011.
Strictly speaking, I can not offer you any 100% C++ 2011 compliant open source compiler, because there aren't any that are 100% there yet.
It looks like you should stay with GCC for now, and GCC 4.6 binaries are included in recent Ubuntu distributions. C++ 2011 is incomplete in GCC 4.6 but contains a lot of 2011 stuff, more than Clang+llvm. It's more than 90% C++ 2011 feature complete. GCC 4.7 contains yet more stuff, but I don't see gcc-4.7 binary packages in Ubuntu 11.x yet, but you can check over here for another way to get gcc 4.7 binaries on ubuntu, or try AskUbuntu, a stackexchange powered site for ubuntu.
According to this page Clang+llvm does not yet offer full C++ 2011 standards compliance, either, and I haven't done the exact math but I see a lot more "No" entries on Clang, versus Gcc.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm using Window 7 OS, I'm Learning C++ for Competitive Programming. I downloaded a version of CodeBlocks but it does not have C++17 (it only has C++98 and C++0x). Is C++17 really important for Learning C++ [preferably for Competitive Programming] or can I carry with my pre-existing CodeBlocks Version? Also, if C++17 is Preferred can you please provide the source to Download C++17 IDE (Codeblocks or Visual Studio). A link would even be more welcomed.
C++17 does not give you access to a new language, it is just an update to an existing language. Most of the competitive programming sites will have c++14 or c++17 running on their servers, so it is preferably good to have one. If you want a pre installed IDE then you can look at the latest version of Visual Studio (probably 2019). Or if you just want a compiler then you can look at MinGW.
Download Visual Studio : https://visualstudio.microsoft.com/vs/
Download MinGW : https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/
Regarding MinGW, it is just a compiler, if you want to use it, then you have to install something like Visual Studio Code, Sublime Text, Atom, etc and then set it up yourself or look at some tutorials on YouTube. Lastly, if you have any other doubts, comment on this answer and I will be pleased to look into the matter.
The version of CodeBlocks you have installed is not the latest. The latest official release (20.03) provides the bundle MinGW compiler version 8.1.0 which supports C++14 and C++17, I seem to remember.
I advise you to install the IDE (CodeBlocks) and the compiler separately.
By installing Msys2 you have the possibility to always update mingw to the latest version (the latest gcc (10.2) offers support for C++20, as well as C++17, 14 and 11).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
macOS High Sierra and Xcode 9 come with an old version of LLVM. It's not obvious which version of LLVM it is because of version number mangling. However, it's apparent it's old as the latest version of LLVM supports C++17 but features like std::optional are not available.
I'd like to write some C++17 code using a Mac. What toolchains are available and what has the fewest complications to get working? My thoughts so far:
LLVM via Homebrew -- interference with/by Xcode?
GCC via Homebrew
Above compiled from source
Any preferred method?
This 'answer' is not an answer to your question. These are the handy bookmarks I use.
I'd use Homebrew to install clang++ (see link below). But if you really want Xcode to interop with it, I'd suggest the "bad news" of wait for Apple, or try out their latest beta. And keep in mind that Apple's "Objective-C++" (*.mm) probably requires Apple's secret sauce, if you have some sort of C++ / Cocoa project.
C++17 implementation status:
https://clang.llvm.org/cxx_status.html
Xcode -to- CLang version:
https://gist.github.com/yamaya/2924292
Homebrew to get CLang (clang++):
https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Not suitable for this site
Improve this question
I have some questions about C++:
Is C++ an open-source project like Linux, Qt, ... or not?
Which community maintains C++ and develops new versions?
If it is open-source where can one access the source code for C++
implementations?
C++ itself is only a description what the language should be,
without a definite implementation.
Anyone can make his own implementations (compiler etc, runtime library, ...)
and call it C++ if it fits to the description.
http://www.open-std.org/jtc1/sc22/wg21/
And if a implementation is open source depends on the creator.
Examples of implementation (parts):
GCC/G++, libc/libc++, clang (++ too), Visual studio and MS´ runtime...
C++ is developed by an ISO standard committee. There's also a C++ foundation that runs a web site you might want to read.
C++ itself is a language, not a specific implementation, so there's no source code available for the standard/language itself.
Some C++ implementations are open source (e.g., Gnu and Clang).
C++ is a code standard defined by the International Organization of Standardization (ISO). There are many different implementations of the language, but they all tend to conform to C++11. Unlike Linux or Qt, C++ is just a standard, and to use any code written in the language you'll need a compiler. The major compilers (list from Wikipedia) are LLVM Clang, GCC, Microsoft Visual C++, and the Intel C++ Compiler.
C++ revisions are dealt with by ISO, and are influenced primarily by the maintainers of the above four implementations.
Clang and GCC are both open-source, I'm sure if you poke around you can find other conforming compilers but those are the two most used.
C++ is an ISO standard. There are many implementation of compilers (and linkers). GCC is an open source project of many compilers one of which is the C++ compiler, g++:
http://gcc.gnu.org/projects/cxx0x.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have been developing a C++11 application against a modern compiler on my mac/linux, which works fine but then I tried to deploy it to a very old linux box (g++ 4.1.2: Feb 2007) and of course that's too old and the executable won't work.
This isn't surprising but now I'm wondering if there is a standard amount of time you are expected to support a compiler/standard?
I had a look around but there is no mention of this.. Should the support for a compiler version drop when the developers themselves deem it end of life and will not patch bugs?
You're the one running gcc (or g++). It's a compiler, used by developers. End-user systems may not have any version of gcc. It's glibc and libstdc++ you need to worry about. But in general, Linux does not aim for binary compatibility. Do not expect any binary executable to run properly on any other distribution/major version.
Conversely, glibc and libstdc++ are careful to work with old kernel versions, so you should be able to install (configure+make+install) the latest runtime support libraries on your Linux box, and then build your application for that.
The easiest way to do that is probably to install the same distribution and version that your target has, into a virtual machine. Then install the C++11 developer tools, and build your application.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
--version shows up 4.4 on Debian Squeeze. Today I left Ubuntu because its simply not stable (about 50++ errors a day) and slow. And I dont like Unity. Debian is great. Reliable, fast and Gnome 2 is okay. I worked on a large c++ project and made heavy use of c++0x features.
My question is: how do I get at least gcc 4.6 on Debian?
Running a mixed system is no option. I mean changing sources.list and upgrade. And full upgrade is no option because of Gnome 3. I will have to wait for Debian MATE. But somehow this has to be accomplished...
You could build the GCC 4.7 (from its FSF source tar ball). This might be painful (it really depends upon your skills), and may take several hours of CPU. Before compiling it, install all the required dependencies (perhaps by compiling them from their source code), and read carefully the GCC install documentation several times.
I am not sure that you are right in avoiding mixing Debian/testing with Debian/stable. I am happily using Debian/unstable on all my desktops and laptops, so I get the latest released GCC.
When you build GCC 4.7.2 from the FSF source tarball, don't forget to build outside of the source tree. Read carefully about the configure options (you probably want --program-suffix=-4.7 for instance). Don't forget to enable plugins (with --enable-plugin at ..../configure time) in your GCC. You could perhaps be interested by MELT, a domain specific language to extend GCC, implemented as a [meta-] plugin.
If you dislike Gnome3 -which I do understand- you might try another Debian based distribution like Linux Mint, or simply use XFCE as your desktop.
You can install certain packages from testing while the others remain stable. See APT Preferences from the debian wiki.