gcc

GCC ICE -- alternative function syntax, variadic templates and tuples

(Related to C++0x, How do I expand a tuple into variadic template function arguments?.) The following code (see below) is taken from this discussion. The objective is to apply a function to a tuple. I simplified the template parameters and modified the code to allow for a return value of generic type. While the original code compiles...

C++: warning: '...' declared with greater visibility than the type of its field '...::<anonymous>'

I'm getting these two warnings (with GCC 4.2 on MacOSX): /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154: warning: 'startMainLockDetector()::MainLockDetector' declared with greater visibility than the type of its field 'startMainLockDetector(...

upgrading boost version

I'm using RHEL 5.3, shipped with gcc 4.1.2 and boost 1.33. So, there's no boost::unorded_map, no make_shared() factory function to create boost::shared_ptr and other features available in newer releases of boost. Is there're a newer version of boost compatible with the version of gcc? If yes, how the upgrade is performed? ...

not able to use g++ from Fedora

$ yum list | grep gcc arm-gp2x-linux-gcc.i686 4.1.2-11.fc12 @fedora arm-gp2x-linux-gcc-c++.i686 4.1.2-11.fc12 @fedora gcc.i686 4.4.3-4.fc12 @updates libgcc.i686 4.4.3-4.fc12 @updates ...

glibc Heap Consistency Checking

According to posts from 2008 (I can't find it right now), glibc heap check doesn't work in multithreaded environment. Is it still situation now in 2010? Does heap check enabled by default? (gcc 4.1.2)? I don't set MALLOC_CHECK_, don't aware of calling mcheck(), but still sometimes receive double free glibc error with backtrace. Maybe it...

powerpc-eabi-objcopy creates 1GByte file

Hello, my elf-file is about 1MByte with all debug symbols. As I try to create a binary file with "powerpc-eabi-objcopy -O binary out.elf out.bin" the out.bin is 1GByte huge. The build script looks like this STARTUP(vectors.o) ENTRY(__exception_reset) INPUT(extras.o) GROUP( libtarget.a libgcc.a libsupc++.a ) MEMORY { rom : ORIGIN = 0x...

GCC, -O2, and bitfields - is this a bug or a feature?

Today I discovered alarming behavior when experimenting with bit fields. For the sake of discussion and simplicity, here's an example program: #include <stdio.h> struct Node { int a:16 __attribute__ ((packed)); int b:16 __attribute__ ((packed)); unsigned int c:27 __attribute__ ((packed)); unsigned int d:3 __attribute__ ((packe...

How Do I Make a PHP Module with the Vala Programming Language?

This new language called Vala, which is said to be C#-like and supposedly easier than C++ or C, compiles down into C on Linux with the GCC compiler. Sounds great. Now I want to use it to make a PHP extension module so that slow PHP code can be made in Vala and imported into PHP as a function. How do I accomplish this in Vala? Is it eve...

template warnings and error help, (gcc)

Hi there, I'm working on an container class template (for int,bool,strings etc), and I've been stuck with this error cont.h:56: error: expected initializer before '&' token for this section template <typename T> const Container & Container<T>::operator=(const Container<T> & rightCont){ what exactly have I done wrong there?. Also n...

left-hand operand of comma has no effect?

Hello there, I'm having some trouble with this warning message, it is implemented within a template container class int k = 0, l = 0; for ( k =(index+1), l=0; k < sizeC, l < (sizeC-index); k++,l++){ elements[k] = arryCpy[l]; } delete[] arryCpy; this is the warning i get cont.h: In member function `void Container<T...

"Ambiguous template specialization" problem

I'm currently porting a heap of code that has previously only been compiled with Visual Studio 2008. In this code, there's an arrangement like this: template <typename T> T convert( const char * s ) { // slow catch-all std::istringstream is( s ); T ret; is >> ret; return ret; } template <typename T, typename T2> T...

gcc does not generate debugger info when using -g, -ggdb, -g3, or -ggdb3

I'm using GCC 4.4.1 and GDB 7.0-ubuntu on Ubuntu 9.10. However, GCC won't generate debugger info when using any of the following switches: -g, -g3, -ggdb, or -ggdb3. So when I run the program with GDB, its as if there was no debugger information generated. I have created very simple test source files in a new, empty folder. Here is one e...

Save gcc compile status to a text file for Java

I'm making a C Assessment Program through Java, which has a bunch of programming questions for C, and it lets the user input an answer in the form of C code, and then press a "Compile" button, which is linked to a bat file that runs the user input code through gcc. I've got the input and compiling working, but I need to get the output f...

How to learn to program C++ the right way

i have been programming in C/C++ for my academic courses a lot and was under the impression i had a pretty good grasp of it. but lately i had to work in a bluetooth application that had a server and client implementation in a Linux box and an embedded system. i learned bluez bluetooth API, socket/network programming and coded it. howev...

Quick question regarding Conditional Compilation (ifndef)

Hello, This is quite probably a very silly question but I need to be sure. I've been given a class declaration in a header file eg. #ifndef file_H #define file_H class ex{ private: public: }; #endif and I've been required to write the method definitions in the same file, which I have done, my question is does the "#endif" stay wher...

GCC: visibility of symbols in standalone C++ applications

Hi, Because of a strange C++ warning about the visibility of some symbols and an interesting answer, linking to a paper which describes the different visibility types and cases (section 2.2.4 is about C++ classes), I started to wonder if it is needed for a standalone application to export symbols at all (except main - or is that needed?...

Overinclusion of libraries C++

I'm reading about how to put a makefile together, but no-one seems to mention what to do if your files require different sets of libraries, they all seem to use the same set of libraries for each file. Since it seems unlikely that every single file has the same libraries, I take it the list they use must amalgamate all of the libraries r...

Illegal instruction gcc assembler.

In assembler: .globl _test _test: pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax pushl %eax call printf popl %ebp ret Calling from c main() { _test("Hello"); } Compile: gcc -m32 -o test test.c test.s This code gives me illegal instruction sometimes and segment fault other times. In gdc i always get illegal instruction, this ...

math library in gcc

I am writing a program on linux gcc... When I tried to include <math.h> I found that I need to link math library by using command gcc -lm But I am searching for another way to link the math library 'in code', that does not require the user to compile using any options.. Can gcc -lm be done in c code using #pragma or something? EDIT:...

How to use gcc 4.5?

http://gcc.gnu.org/install/binaries.html This page has the binaries. Which one would work for Fedora? ...