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
20
votes
8 answers

Installing GCC to Mac OS X Leopard without installing Xcode

I'd like to install gcc to Mac OS X Leopard, and compile some software from source using MacPorts. As http://www.macports.org/install.php has suggested, I've registered as an Apple developer. Now I have to download the Xcode developer tools, but it…
pts
  • 80,836
  • 20
  • 110
  • 183
20
votes
3 answers

Edit and Continue on GDB

I know that E&C is a controversial subject and some say that it encourages a wrong approach to debugging, but still - I think we can agree that there are numerous cases when it is clearly useful - experimenting with different values of some…
Kos
  • 70,399
  • 25
  • 169
  • 233
20
votes
7 answers

Is there a way to use GCC to convert C to MIPS?

I completed a C-to-MIPS conversion for a class, and I want to check it against the assembly. I have heard that there is a way of configuring GCC, so that it can convert C code to the MIPS architecture rather than the x86 architecture (my computer…
Mike
  • 217
  • 1
  • 2
  • 4
20
votes
5 answers

Executable file generated using GCC under cygwin

I am using Cygwin and have GCC (version 4.3.4 20090804 (release) 1 ) installed as Cygwin package. When I built C code using GCC under Cygwin shell, the generated executable output file is a executable of type (PE32 executable for MS Windows…
goldenmean
  • 18,376
  • 54
  • 154
  • 211
20
votes
1 answer

gcc: Strip unused functions

I noticed that sometimes even if I don't use iostream and related I/O libraries, my binaries produced by Mingw were still unreasonably large. For example, I wrote a code to use vector and cstdio only and compiled it with -O2 -flto, my program can go…
John London
  • 1,250
  • 2
  • 14
  • 32
20
votes
2 answers

Segmentation fault for lambda function in non-static data member initializer

I am unsure about a possible GCC bug in initialization of a std::function from a lambda function capturing this in a non-static data member initializer. Is this allowed by the C++ standard or is this UB? Given the following code: #include…
André Sassi
  • 1,076
  • 10
  • 15
20
votes
4 answers

GCC preprocessor

Possible Duplicate: Running the GCC preprocessor Is there a GCC option to make the GCC preprocessor generate C source code but filter out irrelevant source code? For example, a C file has #define switch to define for many different platforms. I'm…
richard
  • 1,607
  • 6
  • 15
  • 18
20
votes
2 answers

Calling printf in x86_64 using GNU assembler

I've written a program using AT&T syntax for use with GNU assembler: .data format: .ascii "%d\n" .text .global main main: mov $format, %rbx mov (%rbx), %rdi mov …
L's World
  • 423
  • 1
  • 5
  • 13
20
votes
3 answers

Compile cgo lib on Cygwin64: "ld: cannot find -lmingw32"

I'm trying to use a cgo library on Windows, namely github.com/mattn/go-sqlite3 I use Cygwin64 and installed with all "Development" packages, so gcc is availabe. But running go get github.com/mattn/go-sqlite3 results…
Fabian Schmengler
  • 24,155
  • 9
  • 79
  • 111
20
votes
3 answers

gcc compiled binaries give "cannot execute binary file"

I compile this program: #include int main() { printf("Hello World!"); return 0; } With this command: gcc -c "hello.c" -o hello And when I try to execute hello, I get bash: ./hello: Permission denied Because the permissions…
Nathan Fig
  • 14,970
  • 9
  • 43
  • 57
20
votes
2 answers

GCC generates redundant code for repeated XOR of an array element

GCC is giving me a hard time generating optimal assembly for following source code: memset(X, 0, 16); for (int i= 0; i < 16; ++i) { X[0] ^= table[i][Y[i]].asQWord; } X being an uint64_t[2] array, and Y being an unsigned char[16] array,…
aprelev
  • 390
  • 2
  • 11
20
votes
2 answers

Cython Fatal Error: Python.h No such file or directory

I have been using Cython to compile my Python files into C files and then use MinGW to create an executable from the C file. Cython works fine, I can type cython test.pyx into the command line and get a C file. The problem is when I attempt to…
Mark Skelton
  • 3,663
  • 4
  • 27
  • 47
20
votes
6 answers

How to get a call stack backtrace? (deeply embedded, no library support)

I want my exception handlers and debug functions to be able to print call stack backtraces, basically just like the backtrace() library function in glibc. Unfortunately, my C library (Newlib) doesn't provide such a call. I've got something like…
hugov
  • 231
  • 1
  • 2
  • 6
20
votes
1 answer

Official status of c++11 support in gcc

This is not a question about which c++11 features are supported by gcc (I believe since 4.8 the c++11 support is pretty complete), but if there are any known problems in using them in production code. The reason I'm asking is that I had a look at…
MikeMB
  • 20,029
  • 9
  • 57
  • 102
20
votes
2 answers

Disable variable-length automatic arrays in gcc

I couldn't disable it even though by using -std=c89 flag. How can I disable it?
Ricardo Cristian Ramirez
  • 1,194
  • 3
  • 20
  • 42