gcc

Porting C++ code from Windows to Linux - Header files case sensitivity issue

I am porting a C++ large project form Windows to Linux. My C++ files include header files that do not match those on the project directory due to the case sensitivity of file names in Linux file systems. Any help? I would prefer finding a flag for gcc (or ext4 file system) to manual editing or sed'ing my files. Thanks for all! ...

Adding MEMORY specifications to a GNU linker script causes segfault

I obtained a generic linker script using "ld --verbose test.o" and simply added a memory section. From what I understand this should work fine, but no matter how I setup the memory section the resulting program never functions properly. (ld generated linker script can be found here). tl;dr; How do you use MEMORY{...} correctly in GNU ...

How to enable exception handling in objective-c and xcode

Hello, EDIT: Issue has been solved(partially):It is a simulator bug. I've compiled and tested this on two devices with iOS 3.1.3 and 4.0. The exception was handled correctly. Be careful, the simulator is your enemy! this is driving me crazy. I don't know how to enable exception handling in my project. Look at the code and debugger outp...

memory layout hack

i have been following this course in youtube and it was talking about how some programmers can use there knowledge of how memory is laid to do clever things.. one of the examples in the lecture was something like that #include <stdio.h> void makeArray(); void printArray(); int main(){ makeArray(); printArray(); r...

Linking to specific or greater library versions using GCC

I am trying to build the BlueZ bluetooth stack to run on an ARM powered GP2X wiz device. I am cross-compiling for the ARM device on a debian machine. I have built the complete stack and all its dependencies, (libusb0.12, dbus, glib-2.0, etc) but I run into issues when running them on the target, and it appears dbus doesn't want to play....

How to get the workaround for GCC warning, "the address of XXX will never be NULL"?

Hi, all. I'm working on C program. There is a function which takes two pointer argument and does some complex works. Let's say it as 'cmp'. cmp() is never complex for the illustrative reason. int cmp(struct foo *a, struct foo *b) { return (a->bar == b->bar); } I'd like to make a NULL-check macro, like this: #define SAFE_CMP(a,b...

GNU Build system que

Hi, I am building my project along with the 3rd party library. They have used asm blocks, Here are the compiler flags am using. -pedantic -pipe -Wundef -Wall -Wchar-subscripts -Wsign-compare -Wno-missing-braces -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-deprecated-declarations -fno-inline -std=c99-g -O2 GC...

Removing Flag in GCC using Pragma

Hi, I want to remove a compiler flag for a praticular file in my project. How to do this using pragma? Thanks Dinesh P ...

in gcc how to force symbol resolution at runtime..

Hi, My first post on this site with huge hope:: I am trying to understand static linking,dynamic linking,shared libraries,static libraries etc, with gcc. Everytime I try to delve into this topic, I have something which I don't quite understand. Some hands-on work: bash$ cat main.c #include "printhello.h" #include "printbye.h" void ...

Why symbols of a shared library are not resolved at link time?

Hi all, This is my 2nd post on this site in my effort to understand the compilation/linking process with gcc. When I try to make an executable, symbols need to be resolved at link time, but when I try to make a shared library, symbols are not resolved at link time of this library. They will perhaps be resolved when I am trying to make a...

How to make GCC search for headers in a directory before the current source file's directory?

I am using GCC precompiled headers in my project with multi-architecture build, but things break down when I try to place it in a directory different from current source's directory. The file is included with double quotes, and it works if I change it to angle brackets, but the problem is that I have a lot of other projects that use th...

How do I tell gcc (or ld) to link against debug versions of the standard c and c++ libraries

I have debug versions of libstdc++ and libc, among others, and would like to link against them. They live in /usr/lib/debug as opposed to /usr/lib. Any ideas? ...

Do g++ thread-local variables follow default initialization rules?

Using g++ to declare function-static thread-local storage: void f() { static __thread somePodStruct thing; ... } can I assume that thing will get zero-initialized? ...

With gcov, is it possible to merge to .gcda files?

I have the same source files (C and Obj-C) being compiled into two targets: the unit test executable and the actual product (which then gets integration tested). The two targets build into different places, so the object files, .gcno and .gcda files are separate. Not all source files are compiled into the unit test, so not all objects wi...

When does GCC define NDEBUG?

Possible Duplicate: Where does the -DNDEBUG normally come from? I am using assertions in my code, but I don't know if they will trigger, because I don't know if NDEBUG is defined or not. Am I supposed to to specify the -DNDEBUG explicitly during compilation? ...

Portable way to use shared_ptr in GCC

GCC 4.1 uses the <tr1/memory> header and GCC 4.3 uses <memory> header, I need a portable way to use shared_ptr with GCC 4.3.2 and with GCC 4.2.1, is there any way to do that without checking GCC version macros or using external libraries like Boost ? ...

Variable name 'xor' results in internal compiler error 'segmentation fault'!

Compiling this code int main(int argc, char **argv) { int xor = 0; } via g++ main.cpp results in: internal compiler error: Segmentation fault with i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659). Renaming the variable removes the error. Question: Is gcc from Apple crap? ...

Link libpq.a(Postgres lib) with Xcode project, dependency errors

Hi! I am trying to link libpq.a to a c++ library being build on Xcode, to use Postgres functions's so I can connect and retrieve data. My problem is that when I build the project, it complains about references from the libpq.a, like in the image below: few minutes ago, it was much more errors... it was complaning about openssl lib ...

Standard C++ libraries headers on gnu gcc site..

Hi all, I want to browse the source code of gnu implementation of C++ standard libraries -- header files as well as the implementation. I have landed myself into: http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/index.html My first step was to look header file at: http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-ht...

Using Autotools for a new shared library

What I want to do is to create a new shared library called libxxx that links against another shared library called libzzz, this shared library has an independent "pkg-config"-like tool, let's say it's called "zzz-config" which gives the cflags needed by the compilation phase when using the libzzz. What I want to do is: Create configure...