How to Check the Version of my gcc?
I didn’t try to compile glibc/gcc myself, and I installed them via yum.
One fishy thing I found is:
And yum showed only 1 version of gcc:
Any idea how to verify the headers in /usr/include/c++/4.8.2 is indeed from 4.8.5 package?
Thanks in advance.
P.S. I think probably glibc is irrelevant but here is the info:
3 Answers 3
The symlink to the 4.8.2 directory is nothing to worry about, it’s normal for the libstdc++ headers on Red Hat Enterprise Linux (and therefore CentOS) to be arranged like that.
gcc —version will tell you the version of the gcc executable in your path.
rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers.
rpm -ql libstdc++-devel will list the files installed by that package, which will include the files under /usr/include/c++/4.8.2
rpm —verify libstdc++-devel will check that you haven’t messed up the C++ headers by replacing them with something else.
Check GCC Version in Ubuntu 20.04 — Step by step guide ?

GCC stands for GNU Compiler Collection. As the name implies, it is a set of compilers that are used for compiling C and various other source codes in Linux and other operating systems. You can read more about GCC on their official website.
Here at LinuxAPT , we shall look into the procedure of checking the GCC version in Ubuntu 20.04.
If it is not installed, follow this guide to install it: https://linuxapt.com/blog/12-install-gcc-on-ubuntu
Different ways of checking GCC Version in Ubuntu
1. In order to check the version of GCC installed on your Ubuntu system using this method, issue the following command on terminal:
The output returned will show you the version.
2. Run the below command to display the version of gcc installed in the system:
[Need help in fixing Ubuntu Linux system packages installation issues ? We can help you . ]
Conclusion
This article covers how to easily check the version of GCC (build-essential) running on Ubuntu 20.04 LTS. In fact, GCC, better known as The GNU Compiler Collection, is a set of compilers, development tools, and front ends such as C, C++, Objective-C, Fortran, Ada, Go, and D.
How To Uninstall gcc from Ubuntu 21.04 ?
To uninstall only the gcc package we can use the following command:
We can use the following command to remove gcc configurations, data and all of its dependencies, we can use the following command:
Как узнать версию gcc
GNU Compiler Collection (обычно используется сокращение GCC) — набор компиляторов для различных языков программирования, разработанный в рамках проекта GNU. GCC является свободным программным обеспечением, распространяется фондом свободного программного обеспечения (FSF) на условиях GNU GPL и GNU LGPL и является ключевым компонентом GNU toolchain. Он используется как стандартный компилятор для свободных UNIX-подобных операционных систем.
Изначально названный GNU C Compiler поддерживал только язык Си. Позднее GCC был расширен для компиляции исходных кодов на таких языках программирования, как C++, Objective-C, Java, Фортран, Ada, Go, GAS и D.
С версии 4.2.2 GCC перешёл на лицензию GPLv3.
Перед установкой
Проверить, установлен ли gcc можно в cmd командой
Если gcc установлени, Вы увидите версию
Если gcc не установлен, Вы увидите следующее сообщение
Microsoft Windows [Version 10.0.18363.720] (c) 2019 Microsoft Corporation. All rights reserved. C:\Users\Andrei>gcc —version 'gcc' is not recognized as an internal or external command, operable program or batch file.
Установка
Для работы в Windows нужен MinGW скачать его можно на сайте nuwen.net/mingw.html
Для этой статьи использовался mingw-17.1.exe
Далее действуйте по инструкции
Двойной клик на mingw-17.1.exe


После установки нужно добавить C:\MinGW\bin в системную переменную среды PATH.
Если Вы не знаете как это сделать, прочитайте мою статью «Системная переменная PATH»
Теперь команда gcc —version должна возвращать версию компилятора.
Microsoft Windows [Version 10.0.18363.720] (c) 2019 Microsoft Corporation. All rights reserved. C:\Users\Andrei>gcc —version gcc (GCC) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Если этого не происходит — перезапустите консоль. Если не помогло — перезапустите Windows.
После установки
Итак, Вы установили MinGW написали простейшую программу 3.cpp, компилируете с помощью gcc
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Andrei\AppData\Local\Temp\ccuoNssB.o:3.cpp:(.text+0x28): undefined reference to `std::ios_base::Init::
Init()' c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Andrei\AppData\Local\Temp\ccuoNssB.o:3.cpp:(.text+0x58): undefined reference to `std::ios_base::Init::Init()' collect2.exe: error: ld returned 1 exit status
Мой совет — попробуйте g++
Если Вы планируете писать софт, который должен будет работать под UNIX-подобными ОС, например Linux или OpenBSD то устанавливать MinGW не стоит.
Попробуйте добавить в Ваш Windows подсистему для Linux и установить gcc там.
Установка gcc в подсистеме Linux для Windows
sudo apt install build-essentials
Установка Cygwin
Если по каким-то причинам Вам не подходят перечисленные выше варианты — установите cygwin cygwin.com
У меня пока что только негативный опыт работы с ним, но у Вас может получиться лучше.
Установка GCC в Linux
В зависимости от типа Linux выполните
sudo apt -y install gcc
Для Debian , Ubuntu и других deb
sudo yum -y install gcc
Для CentOS , Rocky , RHEL и других rpm
Подпишитесь на Telegram канал @aofeed чтобы следить за выходом новых статей и обновлением старых
gcc Getting started with gcc Determine gcc version
When referring to gcc’s documentation, you should know which version of gcc you are running. The GCC project has a manual for each version of gcc which includes features that are implemented in that version. Use the ‘-v’ option to determine the version of gcc you are running.
In this example we see that we are running gcc version 5.3.1. You would then know to refer to the GCC 5.3 manual. It is also helpful to include your gcc version when asking questions in case you have a version specific problem.