compilation - How can I compile C code that has already been C pre-processed with GCC? -
I am performing some source processing between C processing and C compilation. At the moment I:
-
GCC-A file.c> Preprocessed_file.c
. - Do more stuff for
preprocessed_file.c
. - Continue compiling with
preprocessed_file.c
.
If you try to compile the preprocessed_file.c
, then you get a lot of the following if you are in normal C (step 3) :
/usr/include/stdio.h:257: Error: Redefine of parameter 'ban' /usr/include/stdio.h:257: Error: Previous definition of 'Restricted' Here / usr / / Stdio.h: 258: Error: conflicting type for 'restricted' /usr/include/stdio.h:258: Error: Previous definition of 'restricted' here /usr/include/stdio.h: 260: Error: 'Pratib Conflicting types of Dit '[...]
And that's just #include & lt; Stdio.h & gt;
. Fortunately, GCC has an option to say that it is working on C code which has already been prefixed by specifying the language which should be compiled as file.c
in c-cp-output
(See -x
on page). But this does not work: I get it simply:
and absolutely same response with new version of GCC:
$ gcc-mp-4.4 -x c-cpp-output -std = c99 bar.c [the same error stuff has come here]
Looks like a typo in GCC docs - instead try '-x cpp-output'.
gcc -E helloworld.c> Cppout gcc -x cpp- Output cppout -o hw ./hw Hello, world!
Comments
Post a Comment