The GNU Compiler Collection is the standard compiler system used on many Unix-like operating systems, including Linux. Originally meant for compiling C programs, it can now also handle C++, Java and several other languages.
Questions tagged [gcc]
1202 questions
20
votes
3 answers
How can I check that GCC is installed correctly?
I have installed GCC with apt-get.
How can I check that it is installed correctly and which version?

Promy
- 203
14
votes
8 answers
Can I use a C/C++ compiler?
I shifted to Ubuntu 10.10 now I am facing problem to have C/C++ compiler. What are the possible ways so that I can use C/C++ compiler using all the libraries (like graphic, math, conio, stdlib, etc) as in Microsoft Windows creating executable file?

nebula
- 1,267
13
votes
1 answer
Disable PIE and PIC defaults in gcc on ubuntu 17.04?
I have just been painfully discovering that gcc apparently generates -fpic code by default and links with -fPIE by default (On ubuntu 17.04). This completely screws up thousands of tests I run with scripts and makefiles used by lots of different…

user1160711
- 2,277
8
votes
1 answer
Compiling C source file without .c suffix
Let hello_world be a valid C source file. When I try to compile I get
gcc hello_world // hello_world: file not recognized: File format not recognized
I know I could rename to have .c suffix, but if I don't, does gcc support compiling file without .c…

countunique
- 866
- 1
- 10
- 25
6
votes
2 answers
How to use an older version of GCC
I'm using Ubuntu 18.04.4 LTS, and I'm trying to compile a MATLAB-based program (SPM12), following their online instructions, and I believe I'm running into a problem of having a GCC version that is 'too new'.
When I reach a step in the process…

BennyD
- 105
5
votes
1 answer
Where is `__FLT_MAX__` constant defined on Ubuntu?
I am learning C programming using gcc compiler under Ubuntu 14.04 (64bits).
As a practice, I am trying to locate the definitions of size limits of multiple C data types.
I have easily located limits.h in /usr/include, and found the explicit…

Naitree
- 439
5
votes
1 answer
-std=c++11 not recognized on gcc 4.8.1
I just followed an answer to this question to update my gcc version to 4.8. 1 on Ubuntu 12.04, which I thought would support C++11. However it does not seem to.
When I try to compile something with -std=c++11 flag, I get this error:
cc1plus: error:…

Akavall
- 637
- 2
- 10
- 27
4
votes
1 answer
How to downgrade gcc version to 4.8 in Ubuntu 18.04
I upgrade my system from 16.04 to 18.04 but the gcc and g++ version change to 7 such that some of my program cannot compile, so how can I change gcc and g++ version to 4.8?
Thanks

Haolin Li
- 41
4
votes
1 answer
gcc error in Ubuntu 18.04
I try to compile hello.c using gcc with -mnop-mcount option. But error occurs like below:
$ gcc -pg -mfentry -mnop-mcount -o hello hello.c
cc1: error: -mnop-mcount is not implemented for -fPIC
My gcc version is 7.3.0:
$ gcc --version
gcc (Ubuntu…

Frodo
- 59
3
votes
0 answers
Lapack and Blas libraries (changing associated Gfortran compilers)
I work on an Ubuntu 16.04 LTS system, which comes with native gcc-5 and gfortran-5 compilers. I am working on building a project, that recommends gfortran 6.3 and above. So I installed the PPA Test Toolchain and downloaded gcc-7 and gfortran-7…

Ravi
- 31
3
votes
1 answer
Using long double functions with gcc
I am having a hard time getting Ubuntu's gcc to understand the long double-manipulating functions from math.h, namely sqrtl, cabsl and cexpl. The message I get for all of them when compiling is
undefined reference to `sqrtl'
Is there any flag other…

Sir Whiteout
- 325
3
votes
2 answers
What is the extension of output files of gcc operation?
If I do gcc filename.c, I get a.out
After performing gcc -o output_name filename.c we get the executable file output_name.
What is the extension of this file?

srk_cb
- 1,297
- 2
- 12
- 15
3
votes
0 answers
How to compile Saurik's ldid on Ubuntu?
I am trying to install Theos on my Ubuntu and I am stuck on step which is supposed to install ldid:
git clone git://git.saurik.com/ldid.git
cd ldid
git submodule update --init
./make.sh
When I execute make.sh I get following…

Goran
- 31
3
votes
0 answers
How to repair broken gcc compilers
I want to install g++. But I got error
sanket@sanket-Inspiron-N5110:/opt/objdir$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may…

user242117
- 31
- 1
- 5
3
votes
3 answers
how to upgrade gcc to c++11 in ubuntu?
how to upgrade gcc to c++11 in ubuntu? shall I face any problem after upgrading my present gcc?
I am trying to run this code.
`
int main()
{
using namespace std;
int n[5];
//cout << " please enter a character : ";
//cin >> x;
for(int m:n)
cout…