gcc

bleeding-edge libraries and precompiled headers sizes

Q1: My GCC precompiled header takes up 150 mb -- yes I'm using obscure TMP libraries from Boost. Anyone have any tips of benefiting from a PCH this large ? any makefile snippets which I could use to create a ram-disk(tmpfs) or something (transparently / on the fly) ? Q2: Is there some way I could daemonize GCC ? -- after all if it stays...

Cygwin gcc compiled fails in IDE complaining about 'exit' undeclared

When I compile a program using just gcc code.c There are no messages, and an output file is generated successfully. The outputted file works. However, when I try to the same cygwin installation's gcc compiler in an IDE (I've tried Netbeans and Dev-C++), I get the following errors main.cpp:27: error: `exit' undeclared (first use this ...

Use gcc On ELKS

I'm using PocketDOS to emulate ELKS, but I want to develop on it using gcc and ld, how can I do this? ...

Installation of gcc for SimpleScalar on Ubuntu 9.04

So, I'm trying to install gcc for SimpleScalar-3.0, and I keep running into trouble when I execute the command make install LANGUAGES="c c++" CFLAGS="-O3" CC="gcc" as per the instructions in this wiki (Link) I've included the entire output of the command as it runs in the first scroll box and the error message in the second scroll box. ...

How to prevent gcc optimizing some statements in C?

In order to make a page dirty, I touch the first bytes of the page like this: pageptr[0] = pageptr[0]; But it seems gcc will eliminate the statement when optimizing. In order to prevent gcc optimizing it, I write the statement like this: volatile int tmp; tmp = pageptr[0]; pageptr[0] = tmp; It seems the trick works, I'd like to kno...

Why is protos.h file needed by the MDs?

Hi, why do you need the protos.h file in machine descriptions?. I know that it contains all the forward declarations for the functions in the C file. But cant we do without it? Thanks, Isha. ...

How to apply gcc -fvisibility option to symbols in static libraries?

I have a shared library project that is built from 4 static libraries (.a) and one object (.o) file. I am trying to add the -fvisibility=hidden option to restrict symbols in the output to only those that I mark in the source with an _attribute_. I've added the -fvisibility=hidden option to the compile options for the .so project (which ...

gcc compiling invalid C code

Some of my C programs are not working as expected. For example, pass by reference is not possible in C, but when I write a C program which uses that and compile it with gcc it works fine. Is gcc a C++ compiler? How do I make it behave like a C compiler? ...

Why can't I use //-style comments in my C code?

I am using gcc (Unbuntu 4.4.1-4unbuntu9) to compile a program that I'm writing, but it seems to vomit whenever it sees a // comment in my code, saying: interface.c :##: error: expected expression before â/â token Does the gcc compile mode I'm using forbid // comments? $ gcc -g -ansi -pedantic interface.c structs.h -c -I. -I/home/me/pr...

C++ - gcc - how to create my own custom compile warnings similar to printf() ?

howdy. apologies in advance if i use poor terminology. when i compile a C++ app under gdb and use printf() it gives me awesome warnings relating to the consistency of the format string and the arguments passed in. eg, this code: printf("%s %s", "foo"); results in a compiler warning "too few arguments for format", which is super-use...

GCC dump preprocessor defines

Is there a way for gcc/g++ to dump its preprocessor defines from the command line? I mean things like __GNUC__, __STDC__, and so on. ...

iostream.h, fstream.h cannot be found.

I have a 32 bit machine and I am running Ubuntu 9.10 on it. I have the latest gcc compiler. The problem that I am facing is that I have a library developed in 2002. The code is correct for sure but when I try to built it, it gives me errors like iostream.h cannot be found, error: fstream.h: No such file or directory etc etc. There are l...

when I include atomic.h, GCC says No such file, why?

I want to use atomic API, and I include . I don't know how to use it! Thank you! ...

Setting up Notepad++ to compile with GCC on Windows 7 with SUA

Hi, I'm on Windows 7, with Subsystem for Unix-based Applications (SUA) installed. I chose Custom installation and installed GCC in full. Now I can call Korn shell and call gcc helloWorld.c to produce a.out. What I want now is to set up the editor Notepad++ to compile source code when I Run > Run .. or F5. If it helps, I can call Korn...

What if a constructor parameter has the same name as a member variable in C++?

Some code first: class CInner { public: CInner( const CInner& another ) { //impl here } private: // some member variables } class COuter { public: COuter( const CInner& inner ) : inner( inner ) {} private: CInner inner; } Yes, in COuter::COuter( const CInner& ) the parameter has the same name as the member variable. ...

No acceptable C compiler found in $PATH?

Hi all, I want to install Kannel gateway on windowsXP.For that i downloaded the cygwin and installed.After that when i want to configure the kaneel i got the following errors.I set the PATH as C:\cygwin\bin;C:\libxml2-2.6.30+.win32\bin; Running system checks ... checking build system type... i686-pc-cygwin checking host system type... ...

gdb fails with error 193 when debugging MinGW-compiled code

This is shown when I try to debug my code with Eclipse: I then tried creating a simple Hello World program manually with Notepad++ and the command-line gcc. When I launched the gdb debugger this happened: (gdb) run Starting program: C:\Documents and Settings\Pieter\Bureaublad/test.exe Error creating process C:\Documents...

Implementing file locks to make a copy a file.

Develop a C program for file-copy where two processes work together to complete the task: Parent process receives source filename and destination filename from command line. It opens the source file in read mode. Use shared lock on the source file in both the processes. Use exclusive lock on the destination file. Do read/write operatio...

ANSI C (ISO C90): Can scanf read/accept an unsigned char?

Simple question: Can scanf read/accept a "small integer" into an unsigned char in ANSI C? example code un_char.c: #include <stdio.h> #include <stdlib.h> int main(void) { unsigned char character; scanf("%hhu", &character); return EXIT_SUCCESS; } Compiled as: $ gcc -Wall -ansi -pedantic -o un_char un_char.c un_char.c:...

Why are string::append operations behaving strangely?

look at the following simple code: #include <iostream> #include <string> using namespace std; int main() { string s("1234567890"); string::iterator i1 = s.begin(); string::iterator i2 = s.begin(); string s1, s2; s1.append(i1, ++i1); s2.append(++i2, s.end()); cout << s1 << endl; cout << s2 << endl; } w...