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.

GCC is the GNU Compiler Collection, a collection of free software compilers. It is a key component of the GNU Toolchain.

GCC includes an optimizing C compiler that is the most commonly used C compiler on Linux. GCC also includes front ends for C++ (including full support for C++17), Objective-C, Fortran, Ada, and Go, as well as libraries for these languages (libstdc++, libgfortran, ...). It supports many architectures.

GCC sources are available via the Git repository. Major decisions about GCC are made by the steering committee, guided by the mission statement.

See also GCC online documentation and the home page, and release dates.

40905 questions
180
votes
3 answers

How do you use gcc to generate assembly code in Intel syntax?

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
hyperlogic
  • 7,525
  • 7
  • 39
  • 32
178
votes
4 answers

mingw-w64 threads: posix vs win32

I'm installing mingw-w64 on Windows and there are two options: win32 threads and posix threads. I know what is the difference between win32 threads and pthreads but I don't understand what is the difference between these two options. I doubt that if…
Simon
  • 3,224
  • 3
  • 23
  • 17
177
votes
24 answers

What are the useful GCC flags for C?

Beyond setting -Wall, and setting -std=XXX, what other really useful, but less known compiler flags are there for use in C? I'm particularly interested in any additional warnings, and/or and turning warnings into errors in some cases to absolutely…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
177
votes
22 answers

CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

I'm trying make a Visual Studio solution with CMake to compile the latest version of aseprite and CMake keeps giving me the: No CMAKE_C_COMPILER could be found. No CMAKE_CXX_COMPILER could be found. I've already downloaded GCC, and I'm using…
Caio Fontes
  • 1,973
  • 2
  • 12
  • 12
176
votes
3 answers

What is the meaning of "__attribute__((packed, aligned(4))) "

It is C language.It is written that: typedef struct __attribute__((packed, aligned(4))) Ball { float2 delta; float2 position; //float3 color; float size; //int arcID; //float arcStr; } Ball_t; Ball_t *balls; Please tell me…
Aaron Lee
  • 2,060
  • 2
  • 15
  • 20
175
votes
8 answers

What is the purpose of using -pedantic in the GCC/G++ compiler?

This note says: -ansi: tells the compiler to implement the ANSI language option. This turns off certain "features" of GCC which are incompatible with the ANSI standard. -pedantic: used in conjunction with -ansi, this tells the compiler to be adhere…
huahsin68
  • 6,819
  • 20
  • 79
  • 113
173
votes
7 answers

How to compile for Windows on Linux with gcc/g++?

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with g++ -Wall -lglut part8.cpp -o part8 So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything…
Louise
  • 6,193
  • 13
  • 36
  • 36
172
votes
4 answers

warning: incompatible implicit declaration of built-in function ‘xyz’

I'm getting a number of these warnings when compiling a few binaries: warning: incompatible implicit declaration of built-in function ‘strcpy’ warning: incompatible implicit declaration of built-in function ‘strlen’ warning: incompatible implicit…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
172
votes
4 answers

An expensive jump with GCC 5.4.0

I had a function which looked like this (showing only the important part): double CompareShifted(const std::vector& l, const std::vector &curr, int shift, int shiftY) { ... for(std::size_t i=std::max(0,-shift);i
Jakub Jůza
  • 1,113
  • 2
  • 8
  • 13
171
votes
26 answers

Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directory

I have been successfully using gcc on Linux Mint 12. Now I am getting an error. I have recently been doing some .so builds and installed Clang not to long ago, but have successfully compiled since both of those events, so not sure what has changed.…
Scooter
  • 6,802
  • 8
  • 41
  • 64
170
votes
21 answers

How to fix linker error "cannot find crt1.o"?

I have a virtual Debian system which I use to develop. Today I wanted to try llvm/clang. After installing clang I can't compile my old c-projects (with gcc). This is the error: /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld:…
Stefan Keller
  • 1,703
  • 2
  • 11
  • 5
168
votes
4 answers

brew install gcc too time consuming

I'm doing a clean install of Mavericks, and accidentally did brew install gcc which is taking over half an hour, maybe more. Should I terminate it? I know now that I should have installed a specific gcc (maybe gcc48) but it's too late and my…
ehacinom
  • 8,070
  • 7
  • 43
  • 65
168
votes
5 answers

Why does this loop produce "warning: iteration 3u invokes undefined behavior" and output more than 4 lines?

Compiling this: #include int main() { for (int i = 0; i < 4; ++i) std::cout << i*1000000000 << std::endl; } and gcc produces the following warning: warning: iteration 3u invokes undefined behavior…
zerkms
  • 249,484
  • 69
  • 436
  • 539
168
votes
7 answers

How to specify new GCC path for CMake

My OS is centos which has a default gcc in path /usr/bin/gcc. But it is old, I need a new version of gcc. So I install a new version in a new path /usr/local/bin/gcc. But when I run cmake, it still uses the old version gcc path(/usr/bin/gcc) . How…
tidy
  • 4,747
  • 9
  • 49
  • 89
167
votes
7 answers

error: use of deleted function

I've been working on some C++ code that a friend has written and I get the following error that I have never seen before when compiling with gcc4.6: error: use of deleted function ‘GameFSM_ >::hdealt::hdealt()’ is implicitly…
shuttle87
  • 15,466
  • 11
  • 77
  • 106