{"id":5204,"date":"2014-07-05T00:15:08","date_gmt":"2014-07-04T16:15:08","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=5204"},"modified":"2023-10-07T14:54:19","modified_gmt":"2023-10-07T14:54:19","slug":"how-to-check-gcc-version-on-ubuntu","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-check-gcc-version-on-ubuntu\/","title":{"rendered":"How to Check GCC Version on Ubuntu"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-1024x878.jpg\" alt=\"How to Check GCC Version on Ubuntu\" width=\"1024\" height=\"878\" class=\"alignnone size-large wp-image-18491 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-1024x878.jpg 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-300x257.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-128x110.jpg 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-420x360.jpg 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-540x463.jpg 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-720x617.jpg 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-960x823.jpg 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-1140x977.jpg 1140w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-1166x999.jpg 1166w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-840x720.jpg 840w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu-1260x1080.jpg 1260w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/How-to-Check-GCC-Version-on-Ubuntu.jpg 1400w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/878;\" \/><\/p>\n<p>When working with C and C++ programming languages, it is essential to use a compatible compiler that supports the desired language features and optimizes the code accordingly. GCC, the GNU Compiler Collection, is a popular choice for compiling C, C++, Objective-C, Fortran, Ada, and other languages. It is crucial to know the version of GCC installed on your <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-ubuntu-beginners-guide-ubuntu-linux-distro\/\">Ubuntu system<\/a> to ensure that it supports the code you are working with, especially when dealing with recent language features or libraries.<\/p>\n<p>In this guide, we will walk you through the process of checking the GCC version on an Ubuntu system. By following these steps, you will be able to determine if your system has the appropriate version of GCC installed and if an upgrade or downgrade is necessary to meet your development needs.<\/p>\n<p>Let&#8217;s get started!<\/p>\n<h2>Open the Terminal<\/h2>\n<p>To begin, open the terminal application on your Ubuntu system. You can either search for &#8220;Terminal&#8221; in the applications menu or press Ctrl + Alt + T to open a new terminal window.<\/p>\n<h2>Option 1: &#8220;gcc &#8211;version&#8221;<\/h2>\n<p>Once the terminal is open, enter the following command to check the installed GCC version:<\/p>\n<pre>\r\ngcc --version\r\n<\/pre>\n<p>This command will display the current GCC version installed on your system, along with additional information about the compiler.<\/p>\n<pre>\r\nehowstuff@ubuntu14:~$ gcc --version\r\ngcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2\r\nCopyright (C) 2013 Free Software Foundation, Inc.\r\nThis is free software; see the source for copying conditions.  There is NO\r\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r\n<\/pre>\n<h2>Option 2: &#8220;gcc -v&#8221;<\/h2>\n<p>Alternatively, you can type &#8220;gcc -v&#8221; command:<\/p>\n<pre>\r\nehowstuff@ubuntu14:~$ gcc -v\r\nUsing built-in specs.\r\nCOLLECT_GCC=gcc\r\nCOLLECT_LTO_WRAPPER=\/usr\/lib\/gcc\/x86_64-linux-gnu\/4.8\/lto-wrapper\r\nTarget: x86_64-linux-gnu\r\nConfigured with: ..\/src\/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:\/\/\/usr\/share\/doc\/gcc-4.8\/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=\/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=\/usr\/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=\/usr\/include\/c++\/4.8 --libdir=\/usr\/lib --enable-nls --with-sysroot=\/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=\/usr\/lib\/jvm\/java-1.5.0-gcj-4.8-amd64\/jre --enable-java-home --with-jvm-root-dir=\/usr\/lib\/jvm\/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=\/usr\/lib\/jvm-exports\/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=\/usr\/share\/java\/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu\r\nThread model: posix\r\ngcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)\r\n<\/pre>\n<p>The &#8220;gcc -v&#8221; command provides more detailed information about your GCC installation compared to &#8220;gcc &#8211;version&#8221;. When you execute this command, it displays information about the compiler&#8217;s configuration, including the target system, supported languages, and the options used during the compilation process. This information can be helpful if you need to know the specifics of your GCC installation, such as the target architecture or enabled features.<\/p>\n<h2>Option 3: &#8220;aptitude show gcc&#8221;<\/h2>\n<p>Another alternative is to execute &#8220;aptitude show gcc&#8221; command:<\/p>\n<pre>\r\nehowstuff@ubuntu14:~$ aptitude show gcc\r\nPackage: gcc\r\nState: installed\r\nAutomatically installed: yes\r\nVersion: 4:4.8.2-1ubuntu6\r\nPriority: optional\r\nSection: devel\r\nMaintainer: Ubuntu Developers <ubuntu -devel-discuss@lists.ubuntu.com>\r\nArchitecture: amd64\r\nUncompressed Size: 42.0 k\r\nDepends: cpp (>= 4:4.8.2-1ubuntu6), gcc-4.8 (>= 4.8.2-5~)\r\nRecommends: libc6-dev | libc-dev\r\nSuggests: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb,\r\n          gcc-doc\r\nConflicts: gcc-doc (< 1:2.95.3), gcc-doc (< 1:2.95.3), gcc\r\nProvides: c-compiler\r\nDescription: GNU C compiler\r\nThis is the GNU C compiler, a fairly portable optimizing compiler for C.\r\nThis is a dependency package providing the default GNU C compiler.\r\n<\/pre>\n<p>The \"aptitude show gcc\" command gives you information about the GCC package from the package manager's perspective. Aptitude is a package manager used in Debian and Ubuntu systems, and the command provides details such as the package version, dependencies, a description of the package, and its file size. This information can be useful when managing software packages on your system, especially when dealing with dependencies or determining which version of GCC is available through the package manager.<\/p>\n<h2>Commands and Functions:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">gcc<\/span> - The GNU Compiler Collection command<\/li>\n<li><span class=\"fw-bold\">--version<\/span> - An option that displays the version information of the installed GCC<\/li>\n<li><span class=\"fw-bold\">gcc -v<\/span> - This command displays verbose information about the installed GCC version, including the configuration options used during the compilation process, supported languages, and the target architecture.<\/li>\n<li><span class=\"fw-bold\">aptitude show gcc<\/span> - This command provides detailed package information for the installed GCC compiler, including package version, dependencies, description, and file size. Aptitude is a package manager for Debian and Ubuntu systems that simplifies the management of software packages.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>By following these steps, you have successfully checked the GCC version on your Ubuntu system. With this information, you can now determine whether your current GCC installation meets the requirements for your development projects. If necessary, you can upgrade or downgrade your GCC installation to a version that supports the desired language features and optimizations.<\/p>\n<p>We hope this guide has been helpful in learning how to check the GCC version on your Ubuntu server.<\/p>\n<p>Need a reliable host for your Ubuntu project? Head over to our '<a href=\"https:\/\/webhostinggeeks.com\/best\/ubuntu-hosting\/\">Best Ubuntu Hosting 2023<\/a>' guide to ensure your sites run on the best platforms available. <\/p>\n<p>If you have any suggestions or improvements, please feel free to leave a comment below.<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3 class=\"fw-bold\" itemprop=\"name\">What is GCC and why is it important?<\/h3>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">GCC, the GNU Compiler Collection, is a popular compiler for programming languages like C and C++. It's essential for supporting desired language features and optimizing code. Knowing the GCC version on your Ubuntu system ensures compatibility with the code you're working with, especially when dealing with recent language features or libraries.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3 class=\"fw-bold\" itemprop=\"name\">How can I check the GCC version on my Ubuntu system?<\/h3>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can check the GCC version on your Ubuntu system by opening the terminal and entering the command 'gcc --version'. This command will display the current GCC version installed on your system, along with additional information about the compiler.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3 class=\"fw-bold\" itemprop=\"name\">What is the difference between 'gcc --version' and 'gcc -v'?<\/h3>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">While both 'gcc --version' and 'gcc -v' provide information about the installed GCC version, 'gcc -v' provides more detailed information about your GCC installation, including the compiler\u2019s configuration, target system, supported languages, and the options used during the compilation process.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3 class=\"fw-bold\" itemprop=\"name\">What does the 'aptitude show gcc' command do?<\/h3>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">'aptitude show gcc' provides detailed package information for the installed GCC compiler, including package version, dependencies, description, and file size. Aptitude is a package manager for Debian and Ubuntu systems that simplifies the management of software packages.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3 class=\"fw-bold\" itemprop=\"name\">Why is it important to know the GCC version on my Ubuntu system?<\/h3>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">Knowing the GCC version on your Ubuntu system is crucial for ensuring compatibility with the code you're working with. It allows you to determine whether your current GCC installation meets the requirements for your development projects, and if necessary, you can upgrade or downgrade your GCC installation to a version that supports the desired language features and optimizations.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>When working with C and C++ programming languages, it is essential to use a compatible compiler that supports the desired language features and optimizes the code accordingly. GCC, the GNU&#8230;<\/p>\n","protected":false},"author":6,"featured_media":18491,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1073],"tags":[1397,1856],"class_list":["post-5204","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-gcc","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=5204"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5204\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/18491"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=5204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=5204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=5204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}