gcc

Linking Statically with glibc and libstdc++

Hey all, I'm writing a cross-platform application which is not GNU GPL compatible. The major problem I'm currently facing is that the application is linked dynamically with glibc and libstdc++, and almost every new major update to the libraries are not backwards compatible. Hence, random crashes are seen in my application. As a workaro...

function like Macro define

I'd like to define a function like MACRO . i.e. #define foo(x)\ #if x>32\ x\ #else\ (2*x)\ #endif that is, if x>32, then foo(x) present x else, foo(x) present (2*x) but my GCC complains about: int a = foo(31); I think C preprocessor should be handle this correctly. since at compile time, it knows x=33. it could replace foo(33...

Compiling with gcc and debugging with greenhills debugger

I am a newbie to debugging. I compiled my project with gcc and i am trying to debug it with a greenhills debugger. when i try to debug it, i get an error "unreadable memory" in greenhills. Anyone know why and how to fix this error? Any help will be appreciated. Thanks. ...

Are llvm-gcc and clang binary compatible with gcc? - particularly mingw gcc on Windows.

If I build a static library with llvm-gcc, then link it with a program compiled using mingw gcc, will the result work? The same for other combinations of llvm-gcc, clang and normal gcc. I'm interested in how this works out on Linux (using normal non-mingw gcc, of course) and other platforms as well, but the emphasis is on Windows. I'm ...

Getting undefined references when linking against a static library

I made a static library with GCC. Building of the library was OK. When I use it the linker throws undefined reference errors on some functions. But nm says the functions are defined and exported in the static library (marked with T). I know about the linking order that I need to put the libraries after that module that needs them so thi...

Error when building gcc for a cross compiler: "cannot compute suffix of object files: cannot compile"

Hello, My goal is to create a cross compiler (mipsel-soclib-lol), and it's something completly new to me. (I'm following this tutorial: http://www.soclib.fr/trac/dev/wiki/CrossCompiler) So first I have to install few things: binutils, gcc, gdb, etc. Most of them have been installed easily, but I have a problem for the installation of gc...

gcc template error

why in the first line of this code: template <typename VectorType> std::string repr_vector_dynamic(const VectorType* vect) { std::stringstream strs; strs << "("; for (int i = 0; i < vect->size(); ++i) { if (0 != i) { strs << ", "; } strs << (*vect)[i]; } strs << ")"; return str...

make install permission denied even with --prefix passed to configure

I am trying to install gcc (a branch of gcc, not the trunk in the svn), and I configured it with: ./configure --prefix=/home/user/myroot/ --enable-languages=c,c++ \ --disable-multilib --libexecdir=/usr/lib --without-included-gettext \ --enable-threads=posix --disable-werror --with-arch-32=i486 \ --with-tune=generic --enable-...

How to instruct GCC to stop after 5 errors?

Is it possible to instruct GNU c++ compiler to stop after 5 errors found? Can't find this in documentation. Thanks in advance. ...

implementing step over, dwarf

Hi, Im working on a source level debugger. The debug info available in elf format. How could be 'step over' implemented? The problem is at 'Point1', anyway I can wait for the next source line (reading it from the .debug_line table). Thanks if (a == 1) x = 1; //Point1 else if (a == 2) x = 1; z = 1; ...

Installing PIL on Snow Leopard -- NOTHING WORKS

I'm trying to install PIL on Snow Leopard, using Python 2.6.1, GCC 4.2.1, PIL 1.1.7, and have tried with both libjpeg6b and libjpeg7 -- nothing works. I've cleared out every trace of libjpeg/pil/zlib from fink, tried various compiler options, etc. and used http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/ and http:// www....

Change the gcc version that distutils uses

I'm on Snow Leopard, and want distutils to use gcc 4.0 and not 4.2, can anyone tell me how to make it do that? I've tried changing the /usr/bin/g* symlinks, and setting the C* environment vars -- but to no avail. Any thoughts? ...

return nothing from non-void function in C

what is considered best practice in the following snippet: int foo(struct data *bar, struct info bla) { if (!bar) { bla->status = 0; return; } ... } in fact, it works fine. but i'm feeling uncomfortable with gcc giving me a warning. here is the actual code: static int pop(struct stack **stack, struct in...

Anonymous union within struct not in c99?

Hi, here is very simplified code of problem I have: enum node_type { t_int, t_double }; struct int_node { int value; }; struct double_node { double value; }; struct node { enum node_type type; union { struct int_node int_n; struct double_node double_n; }; }; int main(void) { struct int_no...

Problem to compile a C-program by GCC in the latest Cygwin due to tgmath.h and complex.h

I have successfully compiled a C-program with GCC in Mac OS X and Linux, but have got the following error message in Cygwin 1.7.5: /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/tgmath.h:38:21: error: complex.h: No such file or directory I have noticed that several guys reported that tgmath.h has problems in Cygwin. However, due to the la...

Regarding C/C++ in Linux

I have started using Redhat Linux i would like to know how to use Gcc to program in Linux. Also i would like to know how i can access: C C++ Boost GTK+ Libraries in Linux... i saw them getting installed when i installed Linux on my System. Please Help!! ...

doubt regarding operations on "int" flavors

Hi, I am having following doubt regarding "int" flavors (unsigned int, long int, long long int). When we do some operations(* , /, + , -) between int and its flavors (lets say long int) in 32bit system and 64bit system is the implicit typecast happen for "int" for example :- int x ; long long int y = 2000; x = y ; (Higher is assigne...

Can gdb automatically attach a process on a SIGSEGV

Hi, I have a faulty program that when execute receive a SIGSEGV. I can use gdb like this: $ gdb ./prog But I would prefer that gdb catch the SIGSEGV from prog and attach it automatically. $ ./prog Segmentation Fault (gdb) ... Is there a way to do that? Thanks ...

Error compiling with gcc

When i try to compile with gcc i get this error "collect2: _spawnvp: Exec format error". Does anybody know why and how to fix it? Any help will be appreciated. Thanks ...

Portable gcc executable?

So I'm trying to break a few rules quietly. GoDaddy doesn't seem too keen on letting me have Git, and for some reason think that one needs root access to run any gcc (crazy web-hosting support teams). As I try to convince them to do what I tell them to, I'm trying to find a gcc that I can send to my server so I can build git on my own an...