[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Explicitly selecting precompiled headers
From: |
sarathan |
Subject: |
Explicitly selecting precompiled headers |
Date: |
11 Oct 2005 00:19:24 -0700 |
User-agent: |
G2/0.2 |
Hi!
I have 2 files:
// test.h
#include <stdio.h>
#include <stdlib.h>
// test.c
#include "test.h"
int main() {
return 0;
}
I'm compiling using following commands (see
http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html)
g++ test.h
g++ -include test.h.gch test.c
And I get errors like this:
In file included from <command line>:1:
./test.h.gch:1: error: expected constructor, destructor, or type
conversion befo
re '+' token
./test.h.gch:1: error: expected `,' or `;' before '+' token
./test.h.gch:1: error: stray '\15' in program
./test.h.gch:1: error: stray '\15' in program
./test.h.gch:1: error: stray '\21' in program
If I use "g++ -include test.h test.c" then precompiled header is not
used.
I want to explicitly specify what precompiled header to use for
different targets.
Is there any other way to do it?
Is there an error in GCC online docs? I mean: <<This also works with
-include. So yet another way to use precompiled headers, good for
projects not designed with precompiled header files in mind, is to
simply take most of the header files used by a project, include them
from another header file, precompile that header file, and -include the
precompiled header. If the header files have guards against multiple
inclusion, they will be skipped because they've already been included
(in the precompiled header).>>
- Explicitly selecting precompiled headers,
sarathan <=