gcc

How to include header files in GCC search path?

Hey, I have the following code in a sample file: #include "SkCanvas.h" #include "SkDevice.h" #include "SkGLCanvas.h" #include "SkGraphics.h" #include "SkImageEncoder.h" #include "SkPaint.h" #include "SkPicture.h" #include "SkStream.h" #include "SkWindow.h" However, this code is located in various folders within /home/me/development/sk...

warning: incompatible implicit declaration of built-in function ‘xyz’

I'm getting a number of these warnings when compiling a few binaries: warning: incompatible implicit declaration of built-in function ‘strcpy’ warning: incompatible implicit declaration of built-in function ‘strlen’ warning: incompatible implicit declaration of built-in function ‘exit’ To try to resolve this, I have added #include <...

How do you compile without linking in Automake?

I am new to Automake and I am attempting to compile without linking. My goal is to generate a simple Makefile as shown below using Automake. CFLAG = -Wall build: Thread.o Thread.o: Thread.cc Thread.h g++ $(CFLAG) -c Thread.cc clean: rm -f *.o My attempt so far has brought me to the following Makefile.ac. noinst_PROGRAMS =...

Does GCC have a built-in compile time assert?

Our existing compile-time assert implementation is based on negative array index, and it provides poor diagnostic output on GCC. C++0x's static_assert is a very nice feature, and the diagnostic output it provides is much better. I know GCC has already implemented some C++0x features. Does anyone know if static_assert is among them and if...

Problem compiling gcc 4.4.0 on OpenSolaris 2009.6

I am attempting to compile gcc 4.4.0 on opensolaris 2009.6 Currently in the box (which is a AMD 64bit machine), I have the gcc 3.4.6 installed. I unpacked the gcc 4.4.0 tarball. I set the following env variables: export CXX=/usr/local/bin/g++ export CC=/usr/local/bin/gcc Then I ran "configure && make" and this is the error messag...

gcc optimize busy waiting as dead loop

I'm implementing a single-producer single-consumer queue, by which one thread waits for the global queue to be filled by another thread like this: while (queue.head == queue.tail); When I compiled the program will gcc -O0, it worked well. But when it was compiled with gcc -O1, deadloop happened. Then I looked into assembly code and fo...

is it possible to create an object file from other object files in gcc?

I was trying to do something like this in a makefile: program.exe: ui.o main.o gcc ......etc ui.o: window1.o window2.o gcc -c window1.o window2.o -o ui.o #this doesn't want to work window1.o: window1.c window1.h window1_events.c window1_controls.c ... gcc -c window1.c window1_events.c window1_controls.c... -o window1.o window2....

Unable to grep a specifiallyFormatted text

I run man gcc | grep "-L" I get Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. How can you grep the match? ...

How to use the GCC attribute 'format'?

Hello, Here is a little piece of code: #include <stdio.h> #include <stdarg.h> void MyPrintf(char const* format, va_list args); void MyVariadicPrintf(char const* format, ...); void MyPrintf(char const* format, va_list args) { vprintf(format, args); } void MyVariadicPrintf(char const* format, ...) { va_list args; va_start(...

How can I stop g++ from linking unwanted exception-handling code?

I'm developing an embedded application using GCC/G++ compiled for arm-eabi. Due to resource constraints, I'm trying to disable the standard C++ exception handling. I'm compiling the code with "-fno-exceptions -nostartfiles -ffreestanding". When a global instance of a class exists, and that class contains an instance of another class ...

Linking C++ code with 'gcc' (without g++)

Hi all: quick question: I'm in a situation where it would be useful to generate my C++ executable using only 'gcc' (without g++). Reason for this is that I have to submit the code to an automatic submission server which doesn't recognize the 'g++' (or 'c++', for that matter) command. In my experiments, while I'm compiling gcc works well...

GCC: Is it possible to disable the "comma at end of enumerator list" warning when using -pedantic?

Hello, I'm compiling C++ code and I'd like to enable the -pedantic option. I'm using GCC 4.0, running Xcode on Mac OS X Leopard. It is for example possible to allow variadic macros and the long long type that are normally forbidden when using -pedantic (with -Wno-variadic-macros and -Wno-long-long). But I could not find anything to disa...

Document inherited Obj-C methods without Doxygen/compiler warnings?

Background: I'm creating a hierarchy of composite dictionary data structures in Objective-C, and am inheriting from NSMutableDictionary so these classes can be used everywhere an NSDictionary/NSMutableDictionary is called for. (Just so people don't think I'm reinventing the wheel, each one uses a CFMutableDictionaryRef, plus some additi...

Is it possible to get gcc to read from a pipe?

I'm looking for an option to gcc that will make it read a source file from the standard input, mainly so I could do something like this to generate an object file from a tool like flex that generates C code (flex's -t option writes the generated C to the standard output): flex -t lexer.l | gcc -o lexer.o -magic-option-here because I d...

What is the meaning of the GCC warning "case label value exceeds maximum value for type"?

My code looks like this: char * decode_input(char ch) { switch(ch) { case 'g': return "get"; break; case KEY_F(9): return "quit"; break; default: return "unknown"...

How to install gcc-4.4 on cygwin?

I've installed cygwin environment on Windows. There is gcc 4.3. How to install gcc 4.4 in this environment? ...

How to link C lib against python for embedding under Windows?

Hi, I am working on an application written in C. One part of the application should embed python and there is my current problem. I try to link my source to the Python library but it does not work. As I use MinGW I have created the python26.a file from python26.lib with dlltool and put the *.a file in C:/Program Files (x86)/python/2.6/...

Using Cygwin to Compile a C program; Execution error

I'm enrolled in a masters computer science course. The course is using C and the instructor wants us to use Cygwin to compile programs if we are using windows. I've downloaded and installed Cygwin and I've ensured that I've installed the GCC compiler. But I don't know where to go from here. I need to compile a single source file that...

How to suppress the "enumeral and non-enumeral type in conditional expression" warning in GCC

I keep getting this warning from a third-party library (which I don't want to debug), so I'd really appreciate a way to suppress this specific warning. Google failed me, so here I am. ...

Most significant 32 bits lost when casting pointer to int64_t

Can someone explain the following strange behavior? I run the following program on a 64-bit Intel platform: include <stdio.h> #include <stdint.h> int main(void) { int x; int *ptr = &x; printf("ptr = %p\n", ptr); printf("sizeof(ptr) = %d\n", sizeof(ptr)); int64_t i1 = (int64_t) ptr; printf("i1 = 0x%x\n", i1); printf("si...