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
6 answers

How can I determine the return address on stack?

I know that if I am inside some function foo() which is called somewhere from bar() function, then this return address is pushed on stack. #include void foo() { unsigned int x; printf("inside foo…
Vinit Dhatrak
  • 6,814
  • 8
  • 27
  • 30
20
votes
2 answers

Build Python with Mingw and gcc

Is it possible to build Python interpreter from source with Mingw and gcc on Windows 7? And I would like to biuld a 64bit version. If a 64bit Python (gcc Mingw) version is available for download please let me know, I would use that also. At the end…
Theuns Heydenrych
  • 449
  • 1
  • 4
  • 12
20
votes
1 answer

why "undefined reference to `boost::system::generic_category" even if I do link against boost_system

I would understand this error message if I had not put the -lboost_system flag, but it is really here: g++ -o build/myproject build/main/main.o -L/usr/local/boost/boost_1_52_0/boost/libs -L/usr/lib -Lbuild -L. -lboost_system -lboost_thread…
Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
20
votes
2 answers

Link a static library to a shared one during build?

I have a problem building a shared library with GCC/Linux. Currently this shared library is created with GCC/libtool option "-shared" and everything is fine. Now there are two additional, static libraries (.a-files) that have to be added to this…
Elmi
  • 5,899
  • 15
  • 72
  • 143
20
votes
3 answers

What does the '-c' option do in GCC?

What does the -c flag do in gcc? For example, what's the difference between gcc -c output0.c and gcc output0.c ? I know the second one makes a .a file, but I don't know what a .a file is. Also, what does -o do in gcc output0.o -o output0 Is it…
Weadadada Awda
  • 353
  • 1
  • 4
  • 12
20
votes
4 answers

Is it a bug in g++?

#include #include using namespace std; uint32_t k[] = {0, 1, 17}; template bool f(T *data, int i) { return data[0] < (T)(1 << k[i]); } int main() { uint8_t v = 0; cout << f(&v, 2) << endl; cout…
hello.co
  • 746
  • 3
  • 21
20
votes
1 answer

What does the GCC function suffix "isra" mean?

While profiling a program compiled with gcc, I noticed functions like foo.isra.3. What does isra indicate? I notice that one of the functions is only called in a few places, and one of the arguments is always specified as a literal value. Maybe it…
z0r
  • 8,185
  • 4
  • 64
  • 83
20
votes
2 answers

How do I force a 32-bit build of Boost with GCC?

How do I force a 32-bit build of Boost with GCC? Currently attempting by putting this line in my user-config.jam, but it does not work: using gcc : 4.1.2 : g++ : compileflags="-m32" ;
Crazy Chenz
  • 12,650
  • 12
  • 50
  • 62
20
votes
2 answers

Helping the compiler optimize function pointers

A common way of implementing OO-like code encapsulation and polymorphism in C is to return opaque pointers to a structure containing some function pointers. This is a very frequent pattern for example in the Linux kernel. Using function pointers…
Metiu
  • 1,677
  • 2
  • 16
  • 24
20
votes
1 answer

undefined reference to

I have this simple test file: #include "stack.h" int main() { Stack* stck = init_stack(); return 0; } and stack.h is defined as follows: #ifndef STACK_H #define STACK_H #define EMPTY_STACK -1 typedef struct stack { char ch; struct stack*…
user1508893
  • 9,223
  • 14
  • 45
  • 57
20
votes
1 answer

What are GCC’s expensive optimizations?

GCC documentation is not particularly verbose about it. What it says is: -fexpensive-optimizations: Perform a number of minor optimizations that are relatively expensive. Which kind of optimizations are these? Any example?
qdii
  • 12,505
  • 10
  • 59
  • 116
20
votes
5 answers

C++ error : Sleep was not declared in this scope

I am using C++ in Ubuntu with codeBlocks, boost 1.46 in GCC 4.7 [ yield_k.hpp ] I get this compile time error: error : Sleep was not declared in this scope Code: #include using namespace std; int main() { cout << "nitrate"; cout <<…
Mahika
  • 662
  • 2
  • 11
  • 21
20
votes
4 answers

How to print the address of a function?

I let gcc compile the following example using -Wall -pedantic: #include int main(void) { printf("main: %p\n", main); /* line 5 */ printf("main: %p\n", (void*) main); /* line 6 */ return 0; } I get: main.c:5: warning: format ‘%p’…
alk
  • 69,737
  • 10
  • 105
  • 255
20
votes
3 answers

Error "no such instruction" while assembling project on Mac OS X

I used homebrew to install GCC 4.7.0 and my project's make is failing at assembly-time. I can successfully take code from .c -> .s, but .s -> .o fails. To view the brew formula used to install GCC, please look at:…
xrl
  • 2,155
  • 5
  • 26
  • 40
20
votes
4 answers

Equivalence of p[0] and *p for incomplete array types

Consider the following code (it came about as a result of this discussion): #include void foo(int (*p)[]) { // Argument has incomplete array type printf("%d\n", (*p)[1]); printf("%d\n", p[0][1]); // Line 5 } int…
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
1 2 3
99
100