gcc

How to fix 'expected primary-expression before' error in C++ template code?

Here's yet another VC9 vs. GCC 4.2 compile error problem. The following code compiles fine with VC9 (Microsoft Visual C++ 2008 SP1) but not with GCC 4.2 on Mac: struct C { template< typename T > static bool big() { return sizeof( T ) > 8; } }; template< typename X > struct UseBig { static bool test() { return X...

Nasm Inline Assembly Using GCC

In my project I need to use inline Assembly, but it need to be Nasm, because I'm not too much familiar with GAS. My try: void DateAndTime() { asm (.l1: mov al,10 ;Get RTC register A out RTCaddress,al in al,RTCdata test al,0x80 ;Is update in progress? jne .l1 ; yes, wait mov ...

Xscale compilers for Linux? (also Xscale compile flags question)

I am currently using a GCC 3.3.3 based cross compiler to compile for a Xscale PXA270 development board. However, I was wondering if there are other Xscale compilers out there that run on Linux (or Windows for that matter)? The cross compiler setup I am using has horrendous performance on the target device, with certain programs that do...

gcc compilation leaves numerous temp files

Hi everyone, I'm using Red Hat Enterprise Linux 5.4 (it's the latest version) and using gcc 4.1.2 to compile my C project. I've noticed that after the compilation, I get numerous tp* files with 0 bytes each inside the sources folder. I'm using the following options in gcc: gcc -c -ggdb -D__linux -D__ORACLE__ -Wall -I/home/ (more -I her...

How do I set 64-bit alignment for gcc from the command line?

In the man page I only found 8, 16 and 32 bits. ...

Linking C library with non-standard name

Hello, I am using gcc to compile a program which I need to link to a C library with non-standard name; it is called stuff.a instead of libstuff.a. I cannot change the name of the file (permission issues). I don't want to include the full library (i.e. using gcc program.c stuff.a -oprogram) I want to compile as gcc program.c -L/path...

how to merge stripped symbols with binary?

I compiled the Qt Framework with debugging enabled, but the script stripped the debugging symbols from the libraries and saved them as *.debug files -- just like here. Sadly I need these symbols inside the .so files, so I can continue working with them. There seems no way to teach my debugger to load external (non-PDB) symbols. So anothe...

Trying to understand a GCC error

I have the following bit of code: #include <iostream> #include <list> #include <algorithm> #include <iterator> template<typename Iterator> void foo(Iterator begin, Iterator end) { typedef typename std::iterator_traits<Iterator>::value_type type; type smallest = (*std::min_element(begin,end)); std::cout << smallest << std::endl...

GCC vs Greenhills on ARM

I'm interested in any comparisons between GCC and Greenhills C compiler with regard to memory footprint of generated code specifically on ARM platforms. Are there any benchmarks or comparisons for these compilers? Has anyone had any experience here that they'd like to share? ...

Building and using shared libraries with bjam

Hello! Using bjam on ubuntu, I am building a c++ shared library and trying to use it in an executable. I have to build as shared since it wont link as static (lots of undefined references arise). Thats fine. Two related problems: 1) Using a heirarchy of Jamfiles, my exe project (testServerHub) has a dependency on the shared library (p...

Scope of C libraries in C++ - <X.h> vs <cX>

The C++ Programming Language : Special Edition states on page 431 that... For every header < X.h > defining part of the C standard library in the global namespace and also in namespace std, there is a header < cX > defining the same names in the std namespace only. However, when I use C headers in the < cX > style, I don't need to qual...

How do I use gcc builtin __sync_bool_compare_and_swap in g++ on MacOSX?

I have some code that uses: __sync_bool_compare_and_swap it compiles fine on Linux. But when I try to compile it on MacOSX in g++, I get: error: ‘__sync_bool_compare_and_swap’ was not declared in this scope How do I fix this? (This is Mac OSX 10.5.8, so it's intel .. .and should have this instruction). Thanks! ...

Cygwin gcc is adding an underbar "_" prefix to my symbols. Where can I find documentation on this behavior?

Hi - I am trying to compile a gcc project on cygwin for the first time. The build is failing, because an underbar is being prefixed to all symbols. This is causing a symbol mismatch to the GLIB library (installed via CYGWIN package management system) which does not have the leading underbar. Is this tendancy to place a leading underb...

Dump class/struct member variables in g++

Is there a flag in g++ or tools to dump the member variables of a struct/class? To illustrate, consider source code like this struct A { virtual void m() {}; }; struct B : public A { int b; virtual void n() = 0; }; struct C : public B { int c1, c2; void o(); }; struct D : public C { virtual void n() {}; A d; }; I want to get something...

GCC #pragma to stop compilation

Is there a GCC pragma directive that will stop,halt, or abort the compilation process? I am using gcc 4.1 but would want the pragma to be available on gcc 3.x versions also. ...

get heap corruption when changing member variables order

Hi all, i have a quite strange problem. my class has -among others- following memers: GLboolean has_alpha; GLuint width; GLuint height; GLuint length; GLuint millisPerFrame; GLfloat uv[2]; GLuint texsize[2]; GLint compsize; // location2 long preload_interval_next; long preload_interval; if i put the has_alpha at (location2) i g...

Error from gcc compiler

Hi, What does the following error mean: In function `get_ints`: `l` undeclared (first use in this function) Thanks, Josh ...

gcc c++ virtual inheritance problem

Problem: class Base { public: Base(Base* pParent); ... implements basic stuff... }; class A : virtual public Base { public: A(A* pParent) : Base(pParent) {} ... }; class B : virtual public Base { public: B(B* pParent) : Base(pParent) {} ... }; class C : public A, public B { public: C(C* pParent) : A(pParent), B(pParent) {} ...

I need to link C program on a shared object with no section headers

I've written an interface to the code generator that lets me produce shared objects. Though I do not want o implement support for section header table because that's where the majority complexity of ELF file format remains in. GNU ld uses section headers for linking against shared objects. This means that when I try to put gcc link agai...

What are good heuristics for inlining functions?

Considering that you're trying solely to optimize for speed, what are good heuristics for deciding whether to inline a function or not? Obviously code size should be important, but are there any other factors typically used when (say) gcc or icc is determining whether to inline a function call? Has there been any significant academic wor...