gcc

GCC preprocessor

Possible Duplicate: gcc preprocessor Is there a gcc option to make the gcc preprocessor generate C source code but filter out irrelevant source code? For example, a C file has #define switch to define for many different platforms. I'm only intersted in one platform, so I want the C preprocessor to filter out unrelated code. Do...

Good Performance on Octave or Matlab / Bad Performance on gcc

Hallo Everyone, I am actually on topic of 3d-Scanning for robotic pick&place-applications. To get a start I'm using an ICP-algorithmus to match the position of a reference object relative to the actual object. For this purpose I am using Octave/Matlab with the following code: http://www.mathworks.com/matlabcentral/fileexchange/12627-it...

Static library auto-discovery and linking

I have the following problem, which seems not to have a nice solution. For example, I have an CLI utility which uses libtiff and libX11. I want to produce two versions of this utility: dynamically linked and statically linked (with as many dependences compiled-in as possible). For dynamic linking everything works as a charm: one need t...

makefile aliases

Possible Duplicate: makefile aliases Please explain $@ $^ in the makefile below LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32 CFLAGS = -Wall # (This should be the actual list of C files) SRC=$(wildcard '*.c') test: $(SRC) gcc -o $@ $^ $(CFLAGS) $(LIBS) ...

gcc implementation of rand()

I've tried for hours to find the implementation of rand() function used in gcc... It would be much appreciated if someone could reference me to the file containing it's implementation or website with the implementation. By the way, which directory (I'm using Ubuntu if that matters) contains the c standard library implementations for the...

Compilation error in Makefile, includes not showing up

I have a makefile as follows: CC = gcc CFLAGS = -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" $(INCLUDES) ifdef DEBUG CFLAGS += -g3 endif INCLUDES = \ -I../config.include \ -I../log.include \ -I../services.include SRC_DIR = src BIN_DIR = bin BINARY = report SRCS = $(shell ls $(SRC_DIR)/*.cpp) OBJS = $(SRCS:%.cpp=%....

Is it possible to link libstdc++ statically in Mac OSX 10.6?

I am trying to run my C++ program on other Mac OSX machines which may have an older copy of libstdc++, but have all the other tools. I tried to follow this approach, also mentioned in this SO question, even though it discusses a linux setup. I have small program try.cpp: #include <iostream> int main() { int a = 10; std:...

How do I get detailed analysis of a gcc created dylib

I have gcc creating a dylib on osx for me. I'm interested in what exactly takes up how much space in that file, and am looking for a tool/method that would let me see that information. ...

GPS Application in ARM7

Hi, I'm developing a GPS application under Linux, with ARM7 microprocessor. Which compiler do you recommend? Do you know if there is any toolkit with libraries ready to develop GPS applications? A friend of mine recommended gcc... what do you guys think about it? Thank you ...

"file not found " error while creating a static library in c using gcc - linux

I have a file hello.c #include<stdio.h> void hello() { printf("Hello!\n"); } A header hello.h #ifndef _hello_ #define _hello_ void hello(); #endif main.c #include<stdio.h> #include "hello.h" int main() { hello(); return 0; } I am currently in the folder /home/user/name/programs I am trying to build a static libra...

C++ struct array copy

Guys, I want to copy elements of a struct array to another by using memcpy. I believe this is miserably causing my program to fail for some reason. Also how can I free the memory in the end ? struct FaultCodes { string troubleFound; string causeCode; string actionCode; string paymentCode; string suppCode; u_int16_t multipli...

How can I control the way gcc/g++ automatically includes headers?

I've run into trouble in the past when I've tried porting some C++ code written on Mac OS X to a Linux system, or trying to compile code written against an older version of gcc/g++ with a newer one: It seems that some (older?) versions of gcc/g++ would automatically include some header files for you. For example, code that uses printf ...

Relocation overflow when performing bitwise AND (SPARC Assembly)?

I am trying to perform a bitwise AND on a register, as a bitmask to remove the most significant bit (which happens to be bit 16 when counting from 0). However, when I try to compile my code using gcc, it gives me the following error messages: Assembler messages: 19: Error: relocation overflow My guess is that this has something to do w...

Why does CC not see my function definition in header?

Hello.. I'm writing a simple application in ANSI C. I am using GCC in a Unix environment. I have the following sample application: //main.c #include "foo.h" int main() { int result; result = add(1,5); return0; } Header: //foo.h #ifndef FOO_H_INCLUDED #define FF_H_INCLUDED int add(int a, int b); #endif ...

Compiling with header files

Why do I have to specifically compile a C source file with: gcc prog.c -lm even when I have already included the specific header file with: #include <math.h> ...

How do I build a command line tool that links against the iPhone Simulator SDK?

Why the hell would I want to do that? The OpenGL Shader Builder is a great development tool, but it compiles shaders using desktop OpenGL, which allows some things that ES does not. I figure if I can create a tool that links against the OpenGLES.framework in the iPhone Simulator SDK, I can get some error reporting without having to build...

What is the sscanf placeholder for uint8_t types?

What is the sscanf placeholder for uint8_t types? I tried %u, but gcc under OS X doesn't like it. ...

char * to string literal ?

var1 must hold a string whether it is empty or not or my program will segfault. But gcc complains that the empty string literal is constant while var1 is not. The following is an example of what I am talking about. How can I fix this ? warning: assignment discards qualifiers from pointer target type char *var1 = NULL; if(var1 == N...

ISO C++ and the infamous underscore

Possible Duplicate: Why is getcwd() not ISO C++ compliant? After searching for availability of execvp on Windows, particularly with VisualStudio, I've ended up with http://msdn.microsoft.com/en-us/library/ms235414.aspx ... However, it says I should use _execvp instead of execvp. GCC also seems to support _execvp. But what's t...

Try...catch causes segmentation fault on embedded ARM with posix threads

Hi, Totday, I posted a problem about a segmentation fault after destruction of a std::string (see this post). I've stripped the code so that I don't use the STL and still have a segmentation fault sometimes. The following code works just fine on my PC running Linux. But using the ARM crosscompiler suppplied by the manufactor of our emb...