gcc

asm/atomic.h compile error

I have an old C++ project and I'm having problem building it. For a certain file I receive the following kind of errors: error: ‘atomic_t’ was not declared in this scope And others for other identifiers like atomic_read, atomic_inc, etc. The file has an include for asm/atomic.h, but I cannot find the header file on my system. I'm u...

multiple inheritance: unexpected result after cast from void * to 2nd base class

My program needs to make use of void* in order to transport data or objects in dynamic invocation situation, so that it can reference data of arbitrary types, even primitive types. However, I recently discovered that the process of down-casting these void* in case of classes with multiple base classes fails and even crashes my program af...

c++ binary read/write problem

I've looked at binary reading and writing objects in c++ but are having some problems. It "works" but in addidion i get a huge output of errors/"info". What i've done is Person p2; std::fstream file; file.open( filename.c_str(), std::ios::in | std::ios::out | std::ios::binary ); file.seekg(0, std::ios::beg ); file.read ( (char*)&p2, s...

Objective-C, properties for references

This might be iPhone specific, I'm not sure. The compiler doesn't complain when building for the simulator but when compiling for device it throws some funky errors when I try to set properties for references to objects. Eg, @property (nonatomic) CGRect &finalFrame; and the coressponding synthesizer @synthesize finalFrame; for a...

What's the difference between link libstdc++ statically and link libstdc++.a

Hi, all. I've read this article before I asked this question:Linking libstdc++ statically I just can not understand his explaination of why linking statically simplye not ganna work. Can anybody here help me out? (since orignial blog feedback is closed, I can't help but asking here) ...

Qt, GCC, SSE and stack alignment

Hi there, I'm trying to make a program compiled with GCC and using Qt and SSE intrinsics. It seems that when one of my functions is called by Qt, the stack alignment is not preserved. Here's a short example to illustrate what I mean : #include <cstdio> #include <emmintrin.h> #include <QtGui/QApplication.h> #include <QtGui/QWidget.h> ...

How to retrieve the GCC version used to compile a given ELF executable?

I'd like to retrieve the GCC version used to compile a given executable. I tried readelf but didn't get the information. Any thoughts? -Ilyes ...

STLport crash (race condition, Darwin only?)

When I run STLport on Darwin I get a strange crash. (Haven't seen it anywhere else than on Mac, but exactly same thing crash on both i686 and PowerPC.) This is what it looks like in gdb: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address: 0x0000000000000000 [Switching to process 21097] 0x000000010120f...

Compiler fails to catch variable redefinition in conditional block

int bar = 2; if (bar) { int bar; } Neither gcc or Clang manages to issue a warning (or error) for this, and the program crashes immediately on launch. Is there a good reason for this? It doesn't seem like it would be something hard to catch. It's the basics of block scoping: the nested scope inherits the names of the enclosing block...

Unix program using the wrong function from shared libraries

Hello, I'm working on refactoring a suite of old utilities and creating a new server that's going to use common code from all of them to unify their functionality and allow external access by remote clients. For each utility, I'm taking the code I need for the server and refactoring it out into a shared library so that the utility and ...

Map file with GCC on OSX

Hi, I am using GCC on Mac OSX. I am trying to get GCC to create a map(or listing) file of all the symbols in the project so it contains the addresses at which they are mapped. I read in the GCC manual that a way of generating such map files is to pass system specific flags to the GCC linker using -Xlinker option. But I cannot find what...

GCC/VS2008: Different behaviour of function call when templated base class is derived from itself

The following code works with Visual Studio 2008 but not with GCC/G++ 4.3.4 20090804. Which behaviour is - according to the C++ standard - correct? template <int N> struct A : A<N-1> {}; template <> struct A<0> {}; struct B : A<1> {}; template <int N> void Func(const A<N> &a) {} int main() { A<1> a; //is derived from A<0> ...

Where are the static methods in gcc's dump file.c.135r.jump

When I run gcc with the parameter -fdump-rtl-jump, I get a dump file with the name file.c.135r.jump, where I can read some information about the intermediate representation of the methods in my C or C++ file. I just recently discovered, that the static methods of a project are missing in this dump file. Do you know, why they are missing...

Xcode Build Options, etc. Tutorial

I've worked on a few projects now, and I've had to change the framework search paths, set the bundle loader, etc. But I've never felt totally comfortable with that Project (or Target) "Get Info" window. I still don't know what half the stuff in there is, and whenever I change anything, there's always a bit of finger-crossing when I clic...

linker error - linker input file unused because linking not done. then undefined reference to a function in that file

Ok so I'm having trouble with my linking of files. Basically, my program works: the main program, is gen1 gen1 - recieves input sends to str2value for processing, outputs resaults str2value, brakes input into tokens using "tokenizer" deterines what sort of processing to do to each token, and passes them off to str2num, or str2cmd. then r...

why gcc 4.x default reserve 8 bytes for stack on linux when calling a method?

as a beginner of asm, I am checking gcc -S generated asm code to learn. why gcc 4.x default reserve 8 bytes for stack when calling a method? func18 is the empty function with no return no param no local var defined. I can't figure out why 8 bytes is reserved here (neither any forum/site mention for the reason, ppl seems take it for g...

help understanding differences between #define, const and enum in C and C++ on assembly level.

recently, i am looking into assembly codes for #define, const and enum: C codes(#define): 3 #define pi 3 4 int main(void) 5 { 6 int a,r=1; 7 a=2*pi*r; 8 return 0; 9 } assembly codes(for line 6 and 7 in c codes) generated by GCC: 6 mov $0x1, -0x4(%ebp) 7 mov -0x4(%ebp), %edx 7 mov %edx, %ea...

Linking non-object file at a particular address

Hi All, Is there any option in GNU linker or linker script to load a non-object file at a particular address (i.e. the non-object file should be part of the executable image output by linker) ? Any help is appreciated. Regards, Kiran ...

Very simple application fails with "multiple target patterns" from Eclipse

Since I'm more comfortable using Eclipse, I thought I'd try converting my project from Visual Studio. Yesterday I tried a very simple little test. No matter what I try, make fails with "multiple target patterns". (This is similar to this unanswered question.) I have three files: Application.cpp: using namespace std; #include "Window....

Compile e text editor on Linux

Final Edit: show me how to compile e text editor on Ubuntu (32 bit Karmic) and you get the bounty ...