gcc

Enum with 64 bit underlying integer

I'm using gcc, which implements enums as 32 bit integers on the architecture I have (don't know in general). If I try to assign an enum value too large, I get warning: integer overflow in expression Is there a way to make gcc use 64 bit integers as the underlying integer type? A gcc specific way is fine, although if there's a portabl...

Is there any POSIX compatibility layer for Windows x64?

I'm trying to compile Redis for Windows x64 with no luck. I tried different things Cygwin works perfectly but GCC produces only 32 bit executables Compling with Mingw-w64 will not work without a lot of code changes (My understanding is that MinGw does not provide POSIX compatibility for Windows) Microsoft Services for Unix has an outd...

what's the meaning of this coredump?

got this coredump when the application started. Core was generated by `/opt/SURGE/bin/SIM.run 0 0 1'. Program terminated with signal 7, Bus error. #0 0xf79d7ddb in __gxx_personality_v0 () from /opt/SURGE/lib/libTsdThreadedInput_ix86-linux-sles9-mt.so (gdb) bt #0 0xf79d7ddb in __gxx_personality_v0 () from /opt/SURGE/lib/libTsdThreadedI...

calling C/C++ functions of a library compiled with g++, wthin a program compiled with gcc

Dear all, I have a set of software library modules which are developed in c++. So, I use g++ to compile my software. This has to be used by various existing applications which are written in C and compiled with gcc. When the other teams used g++ to compile their code, they started getting lot of compiler errors due to strict type che...

GCC 4.2 Template strange error.

Hello, i have the following code compiled with GCC 4.2 / XCode. template <typename T> class irrProcessBufferAllocator { public: T* allocate(size_t cnt) { return allocProcessBufferOfType<T>(cnt); } void deallocate(T* ptr) { if (ptr) { releaseProcessBuffer(ptr); } } ...

GCC 4.5.0: host-x86_64-unknown-linux-gnu/fixincludes: No such file or directory

When "make check" for GCC4.5.0, such error was occured: make[1]: Entering directory `/home/username/tool/gcc-4.5.0' /bin/sh: line 0: cd: host-x86_64-unknown-linux-gnu/fixincludes: No such file or directory make[1]: *** [check-fixincludes] Error 1 make[1]: Leaving directory `/home/username/tool/gcc-4.5.0' make: *** [do-check] Error 2 H...

Why do I get the same value when printing this int?

So I'm just tinkering around with C and wanted to see if I could assign a binary value to an integer and use the printf() function to output either a signed or unsigned value. But regardless I get the same output, I thought I'd get half the value for printing the signed compared to the unsigned. I'm using Code::blocks and GCC. Does pr...

gcc linker find function reference

I knew gcc linker always looking extern function in later obj or lib file. is there a way tell linker looking reference in entire obj file or lib, if linker did not find in later obj. for examole, ld a.obj b.obj c.obj if linker did not find x function in a.obj, it will looking into b.obj or c.obj. if linker did not find xx function ...

How to implement a timer with interruption in C++?

I'm using the GCC compiler and C++ and I want to make a timer that triggers an interruption when the countdown is 0. Any Ideas? Thanks in advance. EDIT Thanks to Adam, I know how to do it. Now. What about multiple timers running in parallel? Actually, these timers are for something very basic. In NCURSES, I have a list of things. W...

A C program compiled under 32-bit Debian Squeeze causes a segfault on my friend's 64-bit one

Not so long ago I've installed Debian and configured it with my friend's help. Yesterday I have downloaded GCC 4.4 and I created a simple program to test it out. This is the code: #include <stdio.h> int main () { int result; printf ("Hello Wor... Linux! This is my %dst program compiled in Debian.\nHow many is 2+2?\n", 1); s...

What does this mean: "error: invalid combination of multiple type-specifiers"

I'm getting a compiler error on FreeBSD: error: invalid combination of multiple type-specifiers From the C++ Code: typedef unsigned off_t uoff_t; Not sure what the gcc compiler is trying to tell me. ...

What does this mean: "warning: comparison between 'enum A<B>' and 'enum A<B>'"?

I added following at line 42 of proto.h: typedef boost::make_unsigned<off_t>::type uoff_t; And now I get this verbose and confusing warning from gcc complaining about comparing an enum to the same enum type: In file included from proto.cpp:12: /usr/local/include/boost/type_traits/is_unsigned.hpp: In instantiation of 'boost::detail::i...

Simplest way to show a clock in C++ and Linux.

I'm using C++ under Linux compiling with standard GCC. In my program I want to add a simple clock showing HH:MM:SS. What's the easiest way to do that? ...

<functional> (nested bind) problems with MSVC 2010

I have the following code (I'm sorry for the lengthiness): double primeValue( const func1D &func, const double lowerBound, const double upperBound, const double pole ) { // check bounds if( lowerBound >= upperBound ) throw runtime_error( "lowerBound must be smaller than upperBound!" ...

How to setup personal build in CDT eclipse over linux?

Hi, I started using eclipse CDT over Linux for some college exercises. I want the build function to compile without linking? Can i have the build to be as simple as: gcc -c -Wall ? Thanks ...

SIMD version check

Hi, I am using Intel Core2Duo E4500 processor. It is supposed to have SSE3, SSSE3 facilities. But if I try to use them in programs it shows the following error "SSE3 instruction set not enabled" Any ideas? ...

How to do portable 64 bit arithmetic, without compiler warnings.

I occasionally use 64 bit arithmetic in an open source C++ library of mine. I discovered that long long serves my purpose quite nicely. Even some 10 year old solaris box could compile it. And it works without messing around with #defines on Windows too. Now the issue is I get complaints from my users because they compile with GCC -pedan...

Compiling SDL on a MAC

#include "ffmpeg/libavcodec/avcodec.h" #include "ffmpeg/libavformat/avformat.h" #include "ffmpeg/libswscale/swscale.h" #include "ffmpeg/libswscale/rgb2rgb.h" #include "ffmpeg/libswscale/swscale_internal.h" #include <stdio.h> #ifdef __MINGW32__ #undef main /* Prevents SDL from overriding main() */ #endif #include "SDL.framework/Heade...

Allocating memory to pointer structures inside structures

If I have a structure such as typedef struct _people { char *name; bool *exists; struct _people **citizens; } PEOPLE; How do I go about allocating memory so that people->citizens[0]->name is accessible? I've tried info->citizens = malloc(sizeof(PEOPLE *)*numbPeople); However when I try to access info->citizens->name I get th...

What's the trade off for the smaller stack boundary?

In gcc 4.5 the stack must be aligned to a 16-byte boundary when calling a function (previous versions only required a 4-byte alignment). 4-byte is reasonable for 32-bit machine. 16-byte is easy to align by just "and 0xfffffff0, %esp". But it might cost much more memory than 4-byte boundary, doesn't it? In short, My question is why gcc ...