Component | X86_64 | Aarch64 | Description |
gcc | Supported | Supported | C compiler of GCC |
gcc-c++ | Supported | Supported | C++ compiler of GCC, known as g++ in some distributions |
gccgo | Supported | Supported | Golang compiler of GCC |
gfortran | Supported | Supported | Fortran compiler of GCC |
gnat | Supported | Supported | Ada compiler of GCC |
gcc-objc | Supported | Supported | ObjectC compiler of GCC |
gcc-objc++ | Supported | Supported | ObjectC++ compiler of GCC |
gcc-gdc | Supported | Supported | D language compiler of GCC |
gcc-gm2 | Not supported. | Not supported | M2 language compiler of GCC, introduced in GCC 13, not supported in TencentOS Server 4 |
# gccdnf install gcc# gcc-c++dnf install gcc-c++# gccgodnf install gccgo# gfortrandnf install gfortran# libtsandnf install libtsan# Developing with tsandnf install libtsan-devel# For other components, see 1.2 and install them by component name.# Note that libgomp does not provide a devel package.
helloworld.c as an example:#include <stdio.h>int main() {printf("hello,world!\\n");return 0;}
# Install the C compilerdnf install gcc# Compile into a binarygcc -o helloworld helloworld.c# Execute./helloworld
hellooc.cpp as an example:#include <iostream>using namespace std;char* hellooc(char* oc) {cout << "hello, " << oc << "!" << endl;return oc;}
# Install the GCC C++ compiler, C++ development libraries, and runtimednf install gcc-c++ libstdc++-devel
g++ -E -o hellooc.i hellooc.cpp# The result is too long to be displayed in this document. Run the command yourself to view it.less hellooc.i
g++ -S -o hellooc.s -fPIC hellooc.i# The result is too long to be displayed in this document. Run the following command to view it.less hellooc.s
g++ -c -o hellooc.o hellooc.s
# Dynamic Linkingg++ -o hellooc.so -shared -lstdc++ hellooc.o# Static Linkingar rcs hellooc.a hellooc.o
hellooc.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=92a45a52fc17fa866d765841e159d57271e767b1, not strippedhellooc.a: current ar archive
フィードバック