Questions tagged [gcc]
GCC is the GNU Compiler Collection. It's the de facto standard compiler for C, C++, Go, Fortran, and Ada on Linux and supports many other languages and platforms as well.
41,805
questions
2316
votes
12
answers
236k
views
Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optimize the call pow(a,2) by compiling it into a*a, but the call pow(a,6) is not optimized and ...
1884
votes
37
answers
1.8m
views
fatal error: Python.h: No such file or directory
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:
gcc -Wall utilsmodule.c -o Utilc
After executing the command, I ...
1628
votes
23
answers
443k
views
Compiling an application for use in highly radioactive environments
We are compiling an embedded C++ application that is deployed in a shielded device in an environment bombarded with ionizing radiation. We are using GCC and cross-compiling for ARM. When deployed, our ...
1181
votes
11
answers
654k
views
What is the difference between g++ and gcc?
What is the difference between g++ and gcc? Which one of them should be used for general c++ development?
1109
votes
5
answers
135k
views
Why does the C preprocessor interpret the word "linux" as the constant "1"?
Why does the C preprocessor in GCC interpret the word linux (small letters) as the constant 1?
test.c:
#include <stdio.h>
int main(void)
{
int linux = 5;
return 0;
}
Result of $...
800
votes
2
answers
100k
views
Why is my program slow when looping over exactly 8192 elements?
Here is the extract from the program in question. The matrix img[][] has the size SIZE×SIZE, and is initialized at:
img[j][i] = 2 * j + i
Then, you make a matrix res[][], and each field in here is ...
697
votes
31
answers
510k
views
How to automatically generate a stacktrace when my program crashes
I am working on Linux with the GCC compiler. When my C++ program crashes I would like it to automatically generate a stacktrace.
My program is being run by many different users and it also runs on ...
622
votes
11
answers
585k
views
How do I list the symbols in a .so file
How do I list the symbols being exported from a .so file? If possible, I'd also like to know their source (e.g. if they are pulled in from a static library).
I'm using gcc 4.0.2, if that makes a ...
597
votes
11
answers
260k
views
Why does the order in which libraries are linked sometimes cause errors in GCC?
Why does the order in which libraries are linked sometimes cause errors in GCC?
597
votes
5
answers
400k
views
GCC -fPIC option
I have read about GCC's Options for Code Generation Conventions, but could not understand what "Generate position-independent code (PIC)" does. Please give an example to explain me what does it mean.
594
votes
14
answers
2.8m
views
Convert char to int in C and C++
How do I convert a char to an int in C and C++?
588
votes
6
answers
780k
views
Debug vs Release in CMake
In a GCC compiled project,
How do I run CMake for each target type (debug/release)?
How do I specify debug and release C/C++ flags using CMake?
How do I express that the main executable will be ...
561
votes
7
answers
145k
views
What exactly is LLVM?
I keep hearing about LLVM all the time. It's in Perl, then it's in Haskell, then someone uses it in some other language? What is it?
What exactly distinguishes it from GCC (perspectives = safety etc.)...
557
votes
21
answers
898k
views
Undefined reference to vtable
When building my C++ program, I'm getting the error message
undefined reference to 'vtable...
What is the cause of this problem? How do I fix it?
It so happens that I'm getting the error for the ...
534
votes
17
answers
537k
views
How do you get assembler output from C/C++ source in GCC?
How does one do this?
If I want to analyze how something is getting compiled, how would I get the emitted assembly code?