gcc

Is it possible to "embed" a structure of variable type into another structure? (GCC)

Is it possible to embed a structure of varying type inside another structure in C? Basically I want to do something like this. struct A { int n; void *config; } struct AConfig { int a; char *b; } struct BConfig { int a; float b; } const struct A table[] = { { 103, (void*)(struct AConfig){ 1932, "hello" } }, { 438, (void*)(str...

How practical is the GCC native Java compiler as a platform for typical open source Java projects?

EDIT The original reasoning for this question was a pretty serious case of bad timing, and has therefore hidden away in the editing history. In short, fop 1.0 is imminent, so the motivation is largely gone. Besides, the real motivation was mostly frustration anyway. Nevertheless, there is a reasonable question here - how practical is t...

Symbol hiding in static libraries built with Xcode/gcc

I'm trying to figure out whether I can build a static library that hides all of its internal objects and functions, etc, except for the interfaces I want to export. I'm experimenting with Xcode (gcc 4.2). I've used the __attribute__((visibility("hidden"))) attribute on some C++ classes per this documentation. I've also defined little he...

How to implement getch() function of C in Linux?

In turbo c++, we can use getch() function available in conio.h. But in linux, gcc compiler doesn't provide conio.h header file, then how to get functionality of getch() function? ...

Post-Increment Operator: Unexpected Behavior

Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc) My code is as follows: #include <stdio.h> int main() { int x = 10, y = 0; x = x++; printf("x: %d\n", x); y = x++; printf("y: %d\n", y); } Given the nature of post-increment, I would expect the following output: x: 10...

Compiling with LLVM/Clang causes crash, not GCC 4.2

I'm working on an iPhone app, and I'm having some compiler trouble. Here's the low-down: I am compiling using Xcode 3.2.3, targeting iOS 4.0: my device is a 2nd Gen. iPod touch running iOS 4.0. Compiling with GCC 4.2: works on both the simulator and the device Compiling with LLVM compiler 1.5: works on simulator, but not on device. Com...

Error compiling java code with MinGW gcj

Hey,firends,This is my first post. I'm just begin to using Gcc to compile java,and I have some trouble in doing this. My input and output: import java.io.*; import java.util.*; public class Program{ public static void main (String args[]) throws Exception { BufferedReader stdin =new BufferedReader(new InputStreamReader...

Somehow I'm violating the one definition rule

I am getting errors with the linker such as: osd.o(.ndata+0x514):C:\Documents and Settings\Thomas\My Documents\PIC\dsPIC33FJ128GP802\On Screen Display\osd.c: multiple definition of `video_buff_vis_num' main.o(.ndata+0x0):C:\Documents and Settings\Thomas\My Documents\PIC\dsPIC33FJ128GP802\On Screen Display\main.c: first defined here osd....

Xcode: setting to enable C++ even when no C++ sources are in the project?

I have an Objective-C/Cocoa project that incorporates a static library. That static library has some object files that have C++ in them. I've found that if the project that I'm using the library in contains no other C++ in it, the link fails (can't link new/delete/etc). But simply adding a single (empty) .cpp file to the project causes...

Documentation about inline gas

Hi When reading the linux 0.01 kernel I pass throw some inline gas which is hard for me to decode: __asm__("movl $0x3ff000,%%eax\n\t" "movl %%eax,%%db0\n\t" "movl $0x000d0303,%%eax\n\t" "movl %%eax,%%db7" :::"ax") or __asm__("push %%fs;mov %%ax,%%fs;movl %%fs:%2,%%eax;pop %%fs" \ ...

How do I create git tags for legacy gcc releases?

I've cloned the Official GCC git repository, which includes a full GCC development history, but git branch -r lists only a few recent branches, and 'git tag' reports no tag. git fetch --tags didn't help. git svn fetch will recreate tags/branches that were in SVN, but will take about 10 days to complete. I know I could use SVN directly...

variable "undeclared" in "#pragma" command?

I'm compiling a branch of the Blender 3D modeling program from source (using SCONS), on a Fedora 8 box, and am running into an error that I didn't encounter compiling the same source on a CentOS 5 box, and I'm thinking it has to do with the variable definition. The error is: source/blender/blenkernel/intern/implicit.c: In function ‘mul_...

Call class constructor from new operator on GNU - use invalid class

The closest thread to my question is here. I am trying to compile the following code with gcc: #include <malloc.h> class A { public: A(){}; ~A(){}; };//class A int main() { A* obj = (A*) malloc( sizeof(A) ); if(obj==0) return 1 ; obj->A::A(); /*error: invalid use of 'class A' */ obj->A::~A(); free(obj); return 0; }...

It is possible to determine with what gcc vesion a library(.so) has been compiled?

Hello everyone, I have a 3rd party library : lib3rdPartylib.so.It is possible to check with what version of gcc has been this library compiled? Thank you. ...

Speedup GNU make build process - Parallelism?

I build a huge project frequently and this takes long time (more than one hour) to finish even after configuring pre-compiled headers. Are their any guidelines or tricks to allow make work in parallel (e.g. starting gcc in background, ...etc) to allow for faster builds? Note: Sources and binaries are too large in size to be placed in a ...

Problem to compile a C-program by GCC with GD2 library installed via MacPorts

I have successfully compiled a C-program by GCC on Mac with GD2 library installed directly from sources. Now I am trying to do that with GD2 library installed via MacPorts and have the following error message: plotgeometry.c:5:16: error: gd.h: No such file or directory plotgeometry.c: In function 'PlotGeometry': plotgeometry.c:28: erro...

Missing crt1 and crti when crosscompiling

Hey I'am trying to build a cross compile toolchain based on GCC4.5 and newlib with gold and link-time-optimization enabled. GCC compiles fine but it did not generate the crt1.o or crti.o files. Therefore when I tries to use the compiler for building Newlib it complains with the message: ld: error: cannot open crti.o: No such file or di...

how can shared library get its own base address

I have the offset address's of all symbols (obtained with libelf executing on its own binary .so). Now, at runtime, I would need to calculate the absolutue address's of all those symbols and for that I would need to get the base address (where the shared library is loaded) and do a calculation: symbol_address = base_address + symbol_off...

Performance difference between gcc and g++ for C program

Lets say i have written a program in C and compiled it with both gcc and g++, which compilation will run faster? gcc or g++? I think g++ compilation will make it slow, but not sure about it. Let me clarify my question again because of confutation about gcc. Let say i compile program a.c like this on console. gcc a.c g++ a.c which a...

Problem in building gcc 4.5 : error in tools.zip

I tryied to build gcc 4.5.0 on Linux version 2.6.18-164.6.1.el5, and found the following problems that I couldn't find an answer on Google. I used the following command. ../gcc-4.3.5/configure --prefix=/usr --prefix=/apps --with-gmp=/apps --with-mpc=/apps --with-mpfr=/apps --enable-shared --enable-threads=posix make -j 8 Here is the pa...