Difference between revisions of "Gcc compiler"

From Klaus' wiki
Jump to: navigation, search
Line 43: Line 43:
 
* check "Enable indexer" ->>OK
 
* check "Enable indexer" ->>OK
 
* rebuild al
 
* rebuild al
 +
 +
==Reference==
 +
[[https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ SoftwareCollections]]

Revision as of 14:11, 30 January 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
  • rebuild al

Reference

[SoftwareCollections]