gcc4

Why isn't the gcc 4.x.x series compilers installed by MinGW by default?

Currently, MinGW's only installs the 3.x.x series of the gcc compiler by default. However, it looks like the 4.x.x series of compilers have been out for some time, and as others have mentioned, it seems to work just fine. Is there any reason why it hasn't moved to the 4.x.x versions yet, and any reason why I shouldn't use the newer ver...

Cross-compile Autotools-based Libraries for Official iPhone SDK

Background I am writing a program that targets several different phones, including the iPhone. The program depends on several thirdparty libraries. I am having difficulty cross-compiling these thirdparty libraries for the iPhone and iPhone simulator. The libraries include the Apache Portable Runtime and GNUTLS, as well as their dependen...

How are C++-style comments handled in GCC 4.3.3 by default?

I'm using GCC 4.3.3 on Ubuntu 9.04 64-bit and was getting errors using C++-style comments in C code. When I say "by default" in the title, I mean simply invoking gcc test.c According to the GCC 4.3.3 docs (here), this is supported...yet I got the errors anyway. These errors went away with a simple -std=c99 addition to my compile string...

[C++] Error linking with C++

I've try to compile this code: #include <iostream> #include <cstdlib> using namespace std; #define ARRAY_TAM 2 typedef int (*operacion)(int, int); typedef const char* (*Pfchar)(); int suma(int, int); int resta(int, int); const char* descrSuma(); const char* descrResta(); const char* simbSuma(); const char* simbResta(); class OP { ...

some pointer to understanding GCC source code

hi, I'm student working on optimizing GCC for multi-core processor. I tried going through the source code, it is difficult to follow through it since I need to add some code to the back end. Can anyone suggest some good resource which explains the code flow through the different phases. Also suggest some development environment for debug...

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 __attribute__((aligned(4),packed)) I interpret what is being said as the start of the struct is aligned to the 4 byte bo...

Why gcc4 warn and how to avoid it

I have a function declared as: void event_add_card (EventAddr addr, EventType type, unsigned char card); and union typedef union EventData { float money; /**< money info */ unsigned char card; /**< new card */ } EventData; When i compile following code: EventData data = {}; event_add_card (0,0, d...

How to use gcc 4.5?

http://gcc.gnu.org/install/binaries.html This page has the binaries. Which one would work for Fedora? ...

pow doesn't accept the second parameter to be a variable on gcc

pow doesn't accept the second parameter to be a variable on gcc The following code works fine on VC++10 // file test.cc #include "stdafx.h" #include <stdio.h> #include <math.h> int main(void) { double x = 10; int y = 20; printf("%f\n", pow(x, y)); return 0; } But the following code doesn't not work on gcc: // tes...

gcc 4.5 installation problem under ubuntu

I tried to install gcc 4.5 on ubuntu 10.04 but failed. Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu? Following is my steps and the error message, I'd like to know where is the problem.... Step1: download these files: gcc-core-4.5.0.tar.gz gcc-g++-4.5.0.tar.gz gmp-...

How to link static libs (archives) to an empty dynamic lib with gcc4

Greetings all! I'm using gcc on linux to create a shared library. The library itself has no code but links to a couple of static libraries(archives) also built using gcc. I need to export the static libs' symbols through my shared library. What happens is that the resulting shared lib is too small and it actually does not contain any of...

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 should probably be using -march=native, rather than anything listed below. What a...

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 '<membername>' of NULL object warning: (perhaps the 'offsetof' macro was used incorrectly) This problem seems familiar - something I've tried to resolve before and failed, I think, but a wh...

Unexpected const reference behavior

#include <iostream> class A { public: A(){ cerr << "A Constructor" << endl; } ~A(){ cerr << "A Destructor" << endl; } A(const A &o){ cerr << "A Copy" << endl; } A& operator=(const A &o){ cerr << "A Assignment" << endl; return *this; } }; class B : public A { public: B() : A() { cerr << "B Constructor...

g++, doubles, optimization and a big WTF

bug in my gcc? bug in my code? both? http://files.minthos.com/code/speedtest_doubles_wtf.cpp Somehow, it manages to "optimize" a function that results in the array of doubles being zeroed out into taking 2.6 seconds on my q6600, instead of the 33 ms the more complex function takes to fill the array with something somewhat meaningful. ...

No Matching Function - Specialized Signature hiding Generic?

Hello, I just got stuck with the following C++ compiler error: no matching function for call "EPTDerivedException::HandleClass( BaseClass& )" candidates are: void EPTDerivedException::HandleClass( DerivedClass ) I cannot explain this, because there should be a function HandleClass( BaseClass ). This is the calling code: BaseClass oB...

Problem on Mac : "Can't find a register in class BREG while reloading asm"

I tried to port some code onto Mac OS X. The program uses the "ttmath" library, a header big-num header library. This library works fine on both windows and linux, but when I try to compile and run it on a Mac, the following error message always shows up : "can't find a register in class 'BREG' while reloading 'asm'". I found some d...

Will app built with gcc 4.x on CentOS/RHEL 4.8 run on completely un-updated CentOS/RHEL 4?

We have a commercial application that we build on 32-bit CentOS 4.8 (equivalent to Red Hat Enterprise Linux (RHEL) 4 update 8. The default gcc compiler is at 3.4.6 We are able to run our binary on both 32- and 64-bit CentOS/RHEL 4 and 5 including completely un-updated RHEL 4. THE QUESTION: If we update to a newer gcc 4 version, will t...