Skip to main content
The 2024 Developer Survey results are live! See the results

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.

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 ...
xis's user avatar
  • 24.7k
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 ...
Mohanad Y.'s user avatar
  • 19.2k
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 ...
rook's user avatar
  • 66.7k
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?
Brian R. Bondy's user avatar
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 $...
ahmedaly50's user avatar
  • 7,825
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 ...
user avatar
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 ...
KPexEA's user avatar
  • 16.7k
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 ...
Moe's user avatar
  • 29.3k
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?
Landon's user avatar
  • 15.5k
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.
Narek's user avatar
  • 39.7k
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++?
mainajaved's user avatar
  • 8,073
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 ...
Cartesius00's user avatar
  • 24.2k
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.)...
bodacydo's user avatar
  • 78.1k
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 ...
RyanG's user avatar
  • 7,033
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?
Doug T.'s user avatar
  • 65.1k

15 30 50 per page
1
2 3 4 5
2787