Difference between revisions of "Gcc compiler"

From Klaus' wiki
Jump to: navigation, search
(Eclipse showing false errors)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
The default gcc compiler collection that comes with Centos 7 is a version 4.8.5 from 2015. It is OK for the most of our educational work. But in order to be able to use the latest version of especially C++ language it could be handy to upgrade the GCC Compiler Collection.
 
The default gcc compiler collection that comes with Centos 7 is a version 4.8.5 from 2015. It is OK for the most of our educational work. But in order to be able to use the latest version of especially C++ language it could be handy to upgrade the GCC Compiler Collection.
  
 +
==Download and install==
 
Execute this:
 
Execute this:
  
Line 15: Line 16:
 
</source>
 
</source>
  
 +
==Using the new toolchain?==
 
Now in order to use the new toolchain you must run a small utility program, that sets up the environment. Try execute
 
Now in order to use the new toolchain you must run a small utility program, that sets up the environment. Try execute
  
Line 31: Line 33:
 
Finally, if you want to permanently use the new toolchain you can edit the icon in the start menu.
 
Finally, if you want to permanently use the new toolchain you can edit the icon in the start menu.
  
===Eclipse showing false errors===
+
==Eclipse showing false errors==
 
Switching to the new compiler may end up in having a lot of errors shown in the source code. But if you clean your project and rebuild it it may build perfectly without errors and yet still errors are shown in the editor. It is the indexer, that Eclipse uses in order to help you.
 
Switching to the new compiler may end up in having a lot of errors shown in the source code. But if you clean your project and rebuild it it may build perfectly without errors and yet still errors are shown in the editor. It is the indexer, that Eclipse uses in order to help you.
  
Line 40: Line 42:
 
* rebuild all, may show lots of errors
 
* rebuild all, may show lots of errors
 
* check "Enable indexer" ->>OK
 
* check "Enable indexer" ->>OK
* rebuild al
+
* clean and rebuild al
 +
 
 +
==Reference==
 +
[[https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ SoftwareCollections]]

Latest revision as of 14:56, 4 February 2020

The default gcc compiler collection that comes with Centos 7 is a version 4.8.5 from 2015. It is OK for the most of our educational work. But in order to be able to use the latest version of especially C++ language it could be handy to upgrade the GCC Compiler Collection.

Download and install

Execute this:

[~] $  sudo yum install centos-release-scl

This opens for a repository that contains a newer version of the development tools.

Next execute:

[~] $ sudo yum install devtoolset-7

Using the new toolchain?

Now in order to use the new toolchain you must run a small utility program, that sets up the environment. Try execute

[~] $ scl enable devtoolset-7 bash

This will start a new bash shell with the new toolchain enabled.

In order to start Eclipse using the toolchain execute this:

[~] $ scl enable devtoolset-7 /opt/eclipses/eclipse-cdt/eclipse

provided that you have installed your version of Eclipse in the above shown path - if not customise to your needs.

Finally, if you want to permanently use the new toolchain you can edit the icon in the start menu.

Eclipse showing false errors

Switching to the new compiler may end up in having a lot of errors shown in the source code. But if you clean your project and rebuild it it may build perfectly without errors and yet still errors are shown in the editor. It is the indexer, that Eclipse uses in order to help you.

Follow these instructions and you should have rebuild the indexer files:

  • Window / Preferences / C/C++ / Indexer.
  • uncheck "Enable indexer" ->>OK
  • rebuild all, may show lots of errors
  • check "Enable indexer" ->>OK
  • clean and rebuild al

Reference

[SoftwareCollections]