It is all in the commands…
That is the key to installing any software on your hardware or other electronic devices. The biggest task you have is making sure you have the right code, write it on your computer or other device properly and then add the code to the other codes so your installation works like it should.
Sounds simple doesn’t it? Sometimes it is and sometimes people make a small typo and then can’t find where they went wrong. That is where everything becomes frustrating and makes you want to throw the device up against the wall.
To install GCC on a Raspberry just continue to read our article. It has the short way and the long way to get this objective done.
The Short Way
These shortcuts are supposed to make your installation life easier. Hopefully, this one will do just that. Once you get those codes written on your Raspberry Pi you need one more final step to make sure it installs.
That final step along with the codes is to Install gcc-4.7 g++-4.7 on Raspberry Pi, enter the following commands:
$ sudo apt-get install gcc-4.7 g++-4.7 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
Then run the command and select gcc-4.7.
$ sudo update-alternatives --config gcc
Just add those codes to your system and you should be able to have your GCC installed correctly and smoothly.
Shortcuts are great when they work but they can also be more of a time delayer when you make a wrong turn or add a wrong letter or number to the code. Make sure to take your time when using the shortcut so you do not make any mistakes.
The long way
Just to be clear, these instructions are for the current Raspian that is based on the Debian Buster. This system has the GCC 8.3 as the default C and C++ compiler and it may be a bit outdated but it is still a stable system.
Those codes are found at this link. Take your time going through them to make sure you do not make a typing error. The different instructions are included here so you know how to proceed once you get those codes
Step #1: Update your Raspian
Step #2: in case you do not have git on your Raspian
Step #3: In this step you need to open a terminal and download a binary Gcc.
Step #4: Now you need to extract the archive, then move the extracted compilers to /opt and remove the repository.
Once all that is done, you should be able to use your compilers using the following gcc-10.1, g++-10.1 or gfortran-10.1. Double checking is important and you can do that through this code–
After you get through all the steps and double checking, you should be able to see your screen reflect the items listed at that link
There may be some point in the future you will want to remove your GCC 10 from your system. To do that all you need is remove it through gcc-10.1.0 folder from /opt,
At this point you can do a test run. To compile a C++17 that uses an ‘If block’ and an ‘init statement’ use the following steps:
In order to save the code, you need to create a file and name it if_test.cpp.
When that is said and done, you should see something like this on your Raspberry Pi:
Some Additional Information
Some Raspberry Pi devices already have the stock GCC on it and that should include the G++. If yours doesn’t there is a code you can use.
There is also more than one version for the raspbian model and that is because there are about 4 versions of the libstdc++ on the market today. You can check which one is the default through using a code.
Also, your device may install off of the available versions at the same time. That avenue should also include the base library
What Does The GCC Compiler Do
This is a key aspect for your different Linux systems. It helps support different language systems and is a key part of the GNU tool chain. Plus, it is a standard compiler for the Linux Kernel.
The GCC or G++ has been around since 1987 and has gone through different upgrades throughout the years. Now a lot of its duties include working in the instruction set architecture and is usually used in compiling free and proprietary software.
This device is the official compiler for all of GNU’s systems and Linux has also adopted it for many of its systems. It has also been the most used compiler throughout the world.
Some Of Its Features
These special features are what make the G++ such a popular compiler to use. Here are just some of the things it can do:
- Link time optimization- this makes sure the linked binaries work at optimum levels. When object files are joined together the compiler starts up again to make sure the codes interact correctly
- Plugin capability- this can extend the GCC by customizing it to meet your needs. These plugins can eliminate, add or remove middle end passes using the Gimple system
- Transactional memory- you get a boost in this department y using the G++
All in all, your system should be improved once you add the G++ or the GCC system to your arduino system. The key is to make sure you install it correctly and do not make any errors in the coding when you add those in
Some Final Words
If you are a novice then maybe installing the GCC should be left up to those who know what they are doing. It can be very tedious and one typo can mess things up very quickly.
The professionals should be able to get it installed quickly and do a double check to make sure everything is running as it should. Once you get it on there you should be able to perform more functions and duties with your Raspberry Pi.
Keeping your system updated is the way to enhance your electronic experience as well as protect your device.