Questions tagged [gcc4]

Version 4.x of GCC (GNU Compiler Collection). It's the de facto standard C compiler on Linux and supports many other languages and platforms as well.

Version 4.0.0 was released on 2005-04-20. Version 4.9.4 was released on 2016-08-03.

See also:

184 questions
234
votes
6 answers

How do I install imagemagick with homebrew?

I'm trying to install Imagemagick on OSX Lion but something is not working as expected. -> brew install imagemagick /usr/local/git/bin/git ==> Cloning https://github.com/adamv/ImageMagick.git Cloning into…
Kleber S.
  • 8,110
  • 6
  • 43
  • 69
64
votes
3 answers

How to get CMake to pass either std=c++14/c++1y or c++17/c++1z based on GCC version?

GCC 4.x doesn't accept the --std=c++14 switch for C++14 code - it takes --std=c++1y instead. Later versions take --std=c++1z but (probably) not --std=c++17 which has not been set yet (writing this in 2016). Perhaps there are similar issues with…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
26
votes
1 answer

c++ Why is my date parsing not threadsafe?

boost::posix_time::ptime parseDate(const std::string& format, const std::string& localDate) { std::istringstream is(localDate); is.imbue(std::locale(is.getloc(), new boost::local_time::local_time_input_facet(format.c_str()))); …
tauran
  • 7,986
  • 6
  • 41
  • 48
23
votes
1 answer

What exactly does -march=native do?

Gentoo Wiki told me the following: Warning: GCC 4.2 and above support -march=native. -march=native applies additional settings beyond -march, specific to your CPU. Unless you have a specific reason not to (e.g. distcc cross-compiling), you…
György Andrasek
  • 8,187
  • 4
  • 48
  • 76
23
votes
1 answer

What is the default for gcc -march option?

The gcc info file says in the section on x86-64 specific flags, among other things: There is no `-march=generic' option because `-march' indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all…
BehemothTheCat
  • 305
  • 3
  • 7
22
votes
1 answer

What is wrong with this use of offsetof?

I'm compiling some c++ code in MinGW GCC 4.4.0, and getting warnings with the following form... warning: invalid access to non-static data member '' of NULL object warning: (perhaps the 'offsetof' macro was used incorrectly) This…
user180247
18
votes
3 answers

How to set gcc 4.3 default specs file?

When using gcc version 4.3.2, I see how to generate specs using: $ /usr/local/gcc-4.3.2/bin/gcc -v Using built-in specs Now changing to the same directory as libgcc: cd…
Gary
  • 181
  • 1
  • 1
  • 4
16
votes
6 answers

memory alignment within gcc structs

I am porting an application to an ARM platform in C, the application also runs on an x86 processor, and must be backward compatible. I am now having some issues with variable alignment. I have read the gcc manual for…
Mumbles
  • 1,654
  • 3
  • 14
  • 16
15
votes
4 answers

Why do I get cc1plus: error: unrecognized command line option "-arch"?

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf /usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/cppapplication_1 mkdir -p build/Debug/GNU-MacOSX rm -f build/Debug/GNU-MacOSX/main.o.d g++ -arch i386 -c -g…
simpatico
  • 10,709
  • 20
  • 81
  • 126
15
votes
4 answers

C++: nested class of a template class

Consider the following code: template < typename T > struct A { struct B { }; }; template < typename T > void f( typename A::B ) { } int main() { A::B x; f( x ); // fails for gcc-4.1.2 f( x ); // passes …
Vahagn
  • 4,670
  • 9
  • 43
  • 72
14
votes
3 answers

C-callback to function template: explicitly instantiate template

Premise I’m using a C library (from C++) which provides the following interface: void register_callback(void* f, void* data); void invoke_callback(); Problem Now, I need to register a function template as a callback and this is causing me problems.…
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
14
votes
3 answers

Is there a builtin alternative to std::put_time for GCC <5?

I'm stuck on GCC4.8 for the time being. I want to print out the current time as something other than seconds. If put_time worked, my code would be something simple, like this: std::cout << std::setw(24) << std::put_time(c_time, "[%T%z %F]…
Nic
  • 6,211
  • 10
  • 46
  • 69
13
votes
4 answers

(Not So) Silly Objective-C inheritance problem when using property - GCC Bug?

Update - Many people are insisting I need to declare an iVar for the property. Some are saying not so, as I am using Modern Runtime (64 bit). I can confirm that I have been successfully using @property without iVars for months now. Therefore, I…
Ben Packard
  • 26,102
  • 25
  • 102
  • 183
12
votes
4 answers

No useful and reliable way to detect integer overflow in C/C++?

No, this is not a duplicate of How to detect integer overflow?. The issue is the same but the question is different. The gcc compiler can optimize away an overflow check (with -O2), for example: int a, b; b = abs(a); // will…
A Fog
  • 4,360
  • 1
  • 30
  • 32
11
votes
2 answers

why does it cause termination if I try to throw something inside a catch block in C++

I have the following C++ code and it gives me a surprise. The problem is that if I throw something except re-throw inside the catch block, the program will be terminated by calling abort and give the error message in GCC4, "terminate called after…
CS Pei
  • 10,869
  • 1
  • 27
  • 46
1
2 3
12 13