GNU Compiler Collection: Difference between revisions

From ArchWiki
m (→‎Old versions: - forgot a hyphen /o\)
(Add modula-2 to list of frontends)
 
(4 intermediate revisions by 4 users not shown)
Line 19: Line 19:


* {{Pkg|gcc-ada}} for [[Ada]]
* {{Pkg|gcc-ada}} for [[Ada]]
* {{Pkg|gcc-d}} for [[D]]
* {{Pkg|gcc-fortran}} for [[Wikipedia:Fortran|Fortran]]
* {{Pkg|gcc-fortran}} for [[Wikipedia:Fortran|Fortran]]
* {{Pkg|gcc-go}} for [[Go]]
* {{Pkg|gcc-go}} for [[Go]]
* {{Pkg|gcc-m2}} for [[Wikipedia:Modula-2|Modula-2]]
* {{Pkg|gcc-objc}} for [[Wikipedia:Objective-C|Objective-C]]
* {{Pkg|gcc-objc}} for [[Wikipedia:Objective-C|Objective-C]]


=== Old versions ===
=== Old versions ===


Old versions of GCC are available via the [[official repositories]] and the [[AUR]] and may be useful for historical curiosity, old projects that cannot be compiled on the current versions, or for testing the compatibility of projects:
Old versions of GCC may be useful for historical curiosity, old projects that cannot be compiled on the current versions, or for testing the compatibility of projects:


* GCC 4.3: {{AUR|gcc43}}
* GCC 4.3: {{AUR|gcc43}}
Line 40: Line 42:
* GCC 9: {{AUR|gcc9}}
* GCC 9: {{AUR|gcc9}}
* GCC 10: {{AUR|gcc10}}
* GCC 10: {{AUR|gcc10}}
* GCC 11: {{Pkg|gcc11}}
* GCC 11: {{AUR|gcc11}}
* GCC 12: {{Pkg|gcc12}}


Other front-ends for old versions of GCC may be found on the official repositories and the AUR by searching for {{ic|gcc<''version without period''>}}, e.g. searching for {{ic|gcc9}} for GCC 9 front-ends.
Other front-ends for old versions of GCC may be found on the official repositories and the AUR by searching for {{ic|gcc<''version_without_period''>}}, e.g. searching for {{ic|gcc9}} for GCC 9 front-ends.


{{Tip|Use the {{ic|CC}} (for C)[https://cmake.org/cmake/help/latest/envvar/CC.html] and {{ic|CXX}} (for C++)[https://cmake.org/cmake/help/latest/envvar/CXX.html] [[environment variables]] to specify which version of GCC will be used with e.g make or cmake. For example: {{bc|1=$ export CC=gcc-11 CXX=g++-11}}}}
{{Tip|Use the {{ic|CC}} (for C)[https://cmake.org/cmake/help/latest/envvar/CC.html] and {{ic|CXX}} (for C++)[https://cmake.org/cmake/help/latest/envvar/CXX.html] [[environment variables]] to specify which version of GCC will be used with e.g make or cmake. For example: {{bc|1=$ export CC=gcc-12 CXX=g++-12}}}}


== See also ==
== See also ==

Latest revision as of 13:55, 18 March 2024

The GNU Compiler Collection (GCC) is part of the GNU toolchain and includes front ends for C and C++.

Installation

Install the gcc package.

Other available front-ends are:

Old versions

Old versions of GCC may be useful for historical curiosity, old projects that cannot be compiled on the current versions, or for testing the compatibility of projects:

Other front-ends for old versions of GCC may be found on the official repositories and the AUR by searching for gcc<version_without_period>, e.g. searching for gcc9 for GCC 9 front-ends.

Tip: Use the CC (for C)[1] and CXX (for C++)[2] environment variables to specify which version of GCC will be used with e.g make or cmake. For example:
$ export CC=gcc-12 CXX=g++-12

See also