gcc

C++ - static variables initialisation order

C++ guarantees that variables in compilation unit (.cpp file) are initialised in order of declaration. For number of compilation units this rule works for each one separately (I mean static variables outside of classes) , but order between them is undefined. Where I can see some explanations about this order for gcc and MSVC (I know tha...

gcc for MIPS, 3.4.4 or 4.3.2?

We've made a number of changes to gcc 3.3.2 (for MIPS) to support the vagaries of an embedded system we're working on. gcc 3.4 and later appear to have substantially improved the MIPS code generation, so I'm planning to port our changes forward. The question is which gcc version should I target: 3.4.4 or straight to 4.3.2? Its a substant...

GCC compiler error on Windows XP

I'm getting a totally bizzare error trying to compile a C program using GCC. Here is the batch file I am using: echo Now compiling, assembling, and linking the core: nasm -f aout -o start.o start.asm gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o consoleio.o consoleio.c g...

gcc error: wrong ELF class: ELFCLASS64

I was trying to compile a program using an external compiled object coreset.o. I wrote the public01.c test file and my functions are in computation.c, both of which compiles. However its failing on linking it together. What might be the problem? gcc -o public01.x public01.o computation.o coreset.o ld: fatal: file coreset.o: wrong ELF...

GCC with Visual Studio?

How hard would it be to use GCC instead of VC++ from within Visual Studio 2008? Obviously, some of the keywords won't match, and some may not get syntax highlighting (unless you made a new language service). Is this what a 'makefile project' is for, pretty much? ...

Installing GCC 3.4.6 in RHEL4

I do the following in command line: 1) wget ftp://mirrors.kernel.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 2) tar -jxf gcc-3.4.6.tar.bz2 3) cd gcc-3.4.6 4) cd libstdc++-v3 5) ./configure And I get the following error: configure: error: cannot find install-sh or install.sh in ./../.. There is actually an "install-sh" file in the gcc...

MySQL++ library doesn't work after upgrading GCC

I was using mysql++ library and compiling with GCC 3.3.4. That GCC version had some bugs so I upgraded to GCC 3.4.6. After upgrading GCC I rebuilt mysql++ and recompiled my program. But now I get a segmentation fault error. I get the following message: ./mysqlTest: Symbol `_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE' has dif...

g++ or gcc option to get warning message with warning id.

Hi, By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning message ? (Th...

What GNU tools for refactoring are there?

How to refactor c source code that compiles with gcc, preferably a tool that can be used from the command line? ...

Loader scripts for ARM STR7xx

I'm trying to program ARM using Eclipse + CDT + yagarto (gnu toolchain) + OpenOCD. In several sample projects (from yagarto site for example) I found linker scripts (*.ld) where a lot of linking information specified (along with sections definitions). Actually I haven't faced this files before (IAR doesn't need them), and I find them som...

Loading multiple shared libraries with different versions

I have an executable on Linux that loads libfoo.so.1 (that's a SONAME) as one of its dependencies (via another shared library). It also links to another system library, which, in turn, links to a system version, libfoo.so.2. As a result, both libfoo.so.1 and libfoo.so.2 are loaded during execution, and code that was supposed to call func...

How to get RPATH with $ORIGIN to work on Code::Blocks GCC?

I'm trying to link an RPATH containing the special string $ORIGIN into an executable built using GCC with the Code::Blocks IDE. I've specified -Wl,-R$ORIGIN in the linker options for the project, but the command line output to GCC is wrong (stripped for clarity): g++ -Wl,-R What is the correct way to specify this argument for Code:...

Is there a standard way to do findfirst, findnext with gcc on linux using stl?

I can't seem to find the _findfirst / findfirst, _findnext / findnext API on gcc for Linux, and would actually rather use the Standard Template Library (STL) for that if it is included there. Does anyone know what API there is available for listing files in a directory under Linux for C++ (gcc)? ...

Good FAQ For Recompiling apps with GCC for AmigaOS?

There are a couple of open source apps I am trying to recompile to work under amigaOS. Can someone point me to a good step-by-step guide explaining what changes (from a rule-of-thumb standpoint) I need to make to the source before it'll compile? ...

Boost C++ libraries for gcc-arm toolchain

I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option). However, when I try to link a simple sample filesystem app: #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int main(int argc, char *a...

What does a GCC compiled static library contain?

My application links against libsamplerate.a. I am doing this to make distributing the final binary easier. I am worried that perhaps the code inside the .a file depends on some other libraries I also will need to distribute. But if it doesn't I am worried I am bloating up my application too much by including multiple copies of eg. lib...

How do I figure out what -O<num> options do in gcc?

I seem to remember being able to print out (or locate) the specific switches that each -O<num> option turns on. Can you remind? Thanks! ...

C(++) Compiler Transition - Make DJGPP go away please

I'm working on writing a kernel, and I have a few friends working with me on the project. We've been using DJGPP to compile the project for a while, but we're having some cross-platform compatibility issues with compiling this way that have left my main Partnet on the project unable to compile on Windows XP. (DJGPP's GCC is having issues...

How do I test the current version of GCC ?

I would like to include a different file depending on the version of GCC. More precisely I want to write: #if GCC_VERSION >= 4.2 # include <unordered_map> # define EXT std #elif GCC_VERSION >= 4 # include <tr1/unordered_map> # define EXT std #else # include <ext/hash_map> # define unordered_map __gnu_cxx::hash_map # define EXT __...

mtrace for a fortran program

I'm trying to use mtrace to detect memory leaks in a fortran program. I'm using the gfortran compiler. See the wikipedia entry for a (working) C example of mtrace: http://en.wikipedia.org/wiki/Mtrace I tried both ways, i.e. wrapping the mtrace() and muntrace() and call them from the fortran program, as well as create a C program which ...