How to download the latest GCC 12.2 on Windows - c++

I followed the latest compiler installation tutorial I could find on Youtube which was only a month ago. It worked really well until I checked the version downloaded in command prompt. It was outdated 6.3.0, How and where can I download the latest version 12.2? I can't seem to find a tutorial anywhere and even Chat GPT won't know due to its knowledge cutoff in 2021.
I was playing around with the 'Concepts' feature in C++ but it's not working so I suspected it may be that my GCC is outdated since the 'Concepts' feature was introduced on C++20.

Related

Choosing a default gcc/g++ compiler

Im running Matlab on linux (Elementary OS)
The problem im facing is that Matlab isnt compatible with the gcc compiler higher than 4.9.
Same question as: https://www.mathworks.com/matlabcentral/answers/348906-downgrading-gcc-g-for-use-with-mex
When I use "sudo apt get install gcc" 5.4 is automatically installed. When I remove 5.4, Matlab will not recognize 4.9 which I've installed. How do I get Matlab to recognize gcc/g++ 4.9 as my compiler?
I've also followed this but it didnt resolve the problem:
https://www.mathworks.com/matlabcentral/answers/137228-setup-mex-compiler-for-r2014a-for-linux#answer_263109
Any help would be greatly appreciated.
When I remove 5.4, Matlab will not recognize 4.9 which I've installed. How do I get Matlab to recognize gcc/g++ 4.9 as my compiler?
I use Ubuntu (from which you OS is derived) and have had a similar issue. Basically, you can use update-alternative to switch between gcc versions on your choice. Here is a link that explains how to do it.
Here is the documentation on update-alternative, if you need more in-depth knowledge of its functionalities.
Note that uninstalling the default gcc for your distro (5.4 in your case) is no longer required with this solution: you can switch back to it for you development when not using Matlab. You can even install more than two versions of gcc if needed.
Hope this solves your issue.
There is no reason to downgrade GCC for MATLAB.
The reason you run into issues on Linux is because MATLAB installs its own copies of the GCC libraries. If your MEX-files expect newer libraries, they'll fail. You can delete the GCC libraries that come with MATLAB, and it will use the newer ones on your system.
The libraries are at $(MATLABROOT)/sys/os/glnx86 for 32-bit MATLAB, and $(MATLABROOT)/sys/os/glnxa64 for 64-bit MATLAB. $(MATLABROOT) is the installation root for MATLAB.
The files in question are libgcc_s.so*, libstdc++.so* and libg2c.so* (or at least they used to be called like this, I don't have a Linux MATLAB installation here to double-check).
This trick worked for MATLAB 7.0, and still worked a month ago when I suggested this to a colleague.
I do recommend that you rename or move the files, so you can replace them if things go sour.
You will need to restart MATLAB after this change, of course.

Current Cygwin version is not supported by Clion, how to install an earlier version of it?

I am trying to get my Clion 1.1.1 to work with Cygwin. I've installed Cygwin using its setup-x86_64.exe installer. but when I set Cygwin path in Clion's toolchains dialog, it says:
Environment: Cygwin; current version is 2.2.1; supported version range is 1.7.32-2.0.x
On the Cygwin website there is a snapshots page, in which packages are sorted by date (not version) and in faq page it says:
If you are looking for the version number for the whole Cygwin release, there is none. Each package in the Cygwin release has its own version.
So, if there is no version number for whole Cygwin release, what is Clion complaining about?
and if there is, how can I install an earlier version?
afaik, you'll either need an older installer (and some luck on the repos) or someone's older package directory and installer. All recent installers only go back one release which won't be enough to get you back in line with Clion's requirement.
Might also be worth reaching out to Clion and asking them when support for the recent versions is coming out.

Cross-compile C++11/14 on CentOS for Windows

I've set up a CentOS 6.5 box running jenkins, among other things, which I want to use for building a project I'm working on with a couple of friends. It's designed to run on Windows, as we all have windows.
The problem I'm having is that I haven't found a cross-compiler that works on CentOS. Everything I've seen only works on Debian-based distros, and the few that I've found that have been presented as "working on red hat" don't actually work, or their methods of acquisition don't seem viable anymore.
It would be preferable that it supports C++11, or even C++14, as a couple of the guys I'm working on it with haven't ever delved into anything before C++11 and they're "scared of relearning half of what they know."
Everything I've searched for about MinGW or cross-compiling on CentOS has led to a dead end. Am I better off scrapping the installation and installing something debian-based like ubuntu server, or is there a cross-compiler that actually works to compile for windows on redhat distros?
You can use g++ C++ 11. For this you need to install it on your centOS machine. The installation procedure can be found on the following link - Install g++ C++ 11. I have been using this and it works fine.

How to update to C++11?

I am new to programming, so have never experienced a language update. With the release of C++11, I want to make use of all the new features such as lambda expressions and threads. I know I can do this with external libraries but using native language features would be more convenient.
I am using gcc 4.2.1 on Mac OS X Snowleopard in Xcode 3.2.6
What all do I need to do and update to start using C++11 features?
You can update to Xcode 4.1 (or whatever the most recent version you can get for Snow Leopard is) and get a new compiler with a few more C++11 features. There are some posts here on Stack Overflow about getting better support for C++11 in Xcode 4.1 on Snow Leopard.
But even the latest compiler available through Xcode does not support some C++11 features like lambdas. To get the best C++11 support you'll want to install a newer compiler, gcc 4.6 or 4.7, or Clang.
I frequently build the latest version of clang from source. It's not difficult to do if you're familiar with building other open source software. I use the git repos for clang and llvm, http://llvm.org/git/llvm.git and http://llvm.org/git/clang.git. You can also find instructions on their website for getting started: http://clang.llvm.org/get_started.html. Once you have the source for clang and llvm it's just ./configure && make && sudo make install. (you might want to run the tests before installing, since this is directly out of the repository. After make do make check in the llvm directory, and once that passes cd down to tools/clang and run make test. If everything is okay then sudo make install)
I don't remember if Snow Leopard included libc++ or not, so you may need to get that as well. http://libcxx.llvm.org/
Once everything is built and installed you can do:
clang++ -std=c++11 -stdlib=libc++ main.cpp && ./a.out
and you should have just about the best C++11 support around.
Recent patches in clang have really improved support for the last features you're likely to notice as a new C++ programmer. There are still a few bits and pieces left, but as of 3.1, and as far as I'm aware, clang has every C++11 feature that either gcc 4.7 or VC++11 has and more besides. libc++ also has the fewest gaps in terms of C++11 standard library features IME (though I think VC++'s standard library will also be pretty complete once they catch up on language features, e.g. char32_t and char16_t as native types so that the standard's mandated specializations for those types can be used).
Basically you only need to get a toolchain that has support for the new features. In macosx that would be either GCC or clang++. You might need to download/compile a particular version if needed (i.e. if the feature that you want to try is not in a prepacked compiler bundle but is available in the repository).
I downloaded and compiled the latest trunk of clang++ from subversion to do some testing, and installed g++ 4.6 with macports in Snow Leopard. I remember that I had some issues with the setup of the environment, but don't quite remember which of the compilers gave me problems or how I solved them. Google is your friend there :)
If you have homebrew installed, from this article, just two steps:
brew tap homebrew/dupes
brew install gcc --enable-cxx --enable-fortran --use-llvm

What's the latest version of Boost compatible with VC++6?

What is the latest version of the Boost library that is compatible with Microsoft Visual C++ 6? And can you provide a link to download it directly?
The Downloads link at http://www.boost.org only gives a download for version 1.36.0, and the documentation for that version lists Visual C++ 7.1 as the lowest version of Microsoft compiler tested. Do they purge out downloads for older versions?
Boost 1.34.1 has been tested with vc6. The old versions are still available.
You can get all older versions from the boost download page on SourceForge.
The compilers used for regression tests are probably buried somewhere on the boost.org website.
It's worth noting that Boost doesn't actively not support VC6 either. Most of the boost libs probably still work with VC6 (they haven't stripped out the VC6 compatibility code, as far as I know)
So you could just try 1.36.1 and see how far you get.