gcc

Error when building arm-elf-gcc

I'm trying to build a arm-elf-gcc cross compiler. So firts I installed binutils 2.18 with the following configure options: ./configure --target=arm-elf --enable-interwork --enable-multilib This seems to work fine. next I installed gmp, mpfr and libmpc so now to the gcc itself. //edit - removed previous error and updated with the ...

Building a shared library using gcc

SOLVED. See below for the corrections (labeled FIXED). I'm having trouble creating a shared library using gcc. I created a little sample project that closely mirrors the structure of the actual project I'm working on. I've made it available as a tar.gz archive here: http://209.59.216.197/libtest.tar.gz FIXED: I've made the fixed v...

Need some help understanding GCC inline assembly language

int main(void) { int x = 10, y; asm ("movl %1, %%eax;" "movl %%eax, %0;" :"=r"(y) /* y is output operand */ :"r"(x) /* x is input operand */ :"%eax"); /* %eax is clobbered register */ } what is r(y) here also why %% is used before eax. generally single % is used right ? ...

Facebook puzzle error: throws it's automated mail regarding build/run error

I solved the problem (Hoppity) as given on Facebook Puzzle Page. I solved it in c++ language (using g++ compiler) and mailed the .cpp file as an attachment to the mentioned e-mail address. I didn't zip the file. After few hours I received a mail regarding run/build error. Can anyone please help me with this. Where m I going wrong? Here...

Make can't do this harmless command

I am using make on linux. I downloaded the GCC source code from svn checkout svn://gcc.gnu.org/svn/gcc/trunk and I got gcc version 4.6.0. I then typed in: ./configure --build=x86_64-fedora-linux-gnu --target=arm-apple-darwin --with-ecj-jar I'm running fedora 12 linux. I typed in --build because otherwise it configures it under x86_64-unk...

moving a C code from visual studio to linux

hello i am trying to sort a linked list when i sort it it works on visual studio but when i move it to linux the linked list does not get sorted for some reason. my sorts gets a pointer to a pointer of the list and this is my sort code: i call the function like this: SortQueue(&pprocessQueue, ProcessPrIdCompare); and here is my function...

Boost linking error for boost filesystem, why?

I have built boost 1.44 on CentOS 5.5 using the gcc that is part of CentOS 5.5. All targets built fine. However trying to build a simple cpp file with nothing but an include of boost filesystem results in this linking error (3 times): undefined reference to `boost::system::generic_category()' I cannot see why this would happen. The lib...

g++ standards support

I am a bit puzzled reading this: Gcc 4.5 online manual --- Standards section. They explain this The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and C++03, respectively. GCC imple...

Where is ptrdiff_t defined in C?

Where is ptrdiff_t defined in C? If non-trivial, how can I make this type visible from GCC on Linux? ...

g++ warning: comparison of unsigned expression < 0 is always false

To compile my C++ code I use the -W flag, which causes the warning: warning: comparison of unsigned expression < 0 is always false I believe this was considered as a bug and was fixed on version GCC 4.3, but I'm using GCC 4.1 Code that is obviously offending here: void FieldGroup::generateCreateMessage (const ApiEvent::GroupData ...

unused parameter warnings in C code

What's the best way to suppress "unused parameter" warning in C code. For instance, Bool NullFunc(const struct timespec *when, const char *who, unsigned short format, void *data, int len) { return TRUE; } In C++ I was able to put /.../ around the parameters. But not in C of course. It gives me "error: parameter name omitted". So...

__attribute__((aligned)) - gcc

Hello How will gcc set the alignment for variable/field with __attribute__((aligned)) What about different gcc versions/ different platforms? Testing code: int main() { printf("%d\n", (__alignof__(char __attribute__ ((aligned)) )) ); } For x86, gcc 3.4, 4.1, 4.3 I got 16. ...

GNU assembler for MIPS: how to emit sync_* instructions?

MIPS32 ISA defines the following format for the sync instruction: SYNC (stype = 0 implied) SYNC stype here, stype may be SYNC_WMB (SYNC 4), SYNC_MB (SYNC 16), etc. In inline assembler, I may use default sync: __asm__ volatile ("sync" ::);. But, if I write something like __asm__ volatile ("sync 0x10" ::), it doesn't compile: Error: ...

C++ array initialization not working

I am trying to initialize an array of bools like so: bool FcpNumberIsOk[MAX_FCPS]={true}; but when I debug it, I only see the first element of the array initialized, the others are false. How can that be so? I am using Qt on ubuntu 10 and the initialization is done on a local array inside a method. Ok thanks for your answers. ...

how to create binary and .so using libtool

I have a set of cpp files that I want to compile directly into a binary and also to compile into a shared library. I have bin_PROGRAMS=mybin lib_LTLIBRARIES=libmylib.la COMMON_SOURCES=f1.cpp f2.cpp f3.cpp mybin_SOURCES=main.cpp $(COMMON_SOURCES) libmylib_la_SOURCES=$(COMMON_SOURCES) When I run this the cpp files are compiled twice...

Evaluate macro parameter once only

In the following code, whatever is passed as retval is evaluated as given for every use of that token. #define _CPFS_RETURN(commit, retval) do { \ util_cpfs_exit(commit); \ return retval; \ } while (false) #define CPFS_RETURN_BOOL(retval) do { \ _CPFS_RETURN(retval, retval); \ } while (false) For examp...

Problems linking to a library with gcc

I installed SFML from scratch today so I could work on a game. I downloaded the source, ran sudo make install, tried compiling one of my old projects, and I couldn't get it to link properly. So I tried running a simpler project: one of the samples in the tutorials. I tried to compile this one specifically, but I get these errors: g++ -o...

How to remap a symbol to call a different function

Hi, I have an ELF shared object, and i want to modify it so that calls to the system function memcpy are actually routed through to a custom version of memcpy. Ive been researching and i have read about PLT Redirection and ELF Infection, but im still not sure how i can accomplish my goal Can anyone give me some hint and tips, or elabo...

Segfault on AIX from large C++ library

I'm trying to convert a Windows based library that my company produces to run on AIX. We are currently able to run it on Solaris and Linux but AIX is causing some additional issues. I'm not sure if this is an OS setup issue or a coding issue but I'm trying the coding approach first. The library exports some function using a C style con...

App with embeded GCC-XML parser support

Hi, What should be the right approach to reuse GCC-XML parser utility inside any other Windows C++ native or C# .NET application ? I read that it is used by some libs like pygccxml, PyQt, it is not yet clear how. Please enlighten me. Seems no API documentation is available... Thanks ...