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:

  1. GCC-A file.c> Preprocessed_file.c .
  2. Do more stuff for preprocessed_file.c .
  3. 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; file.c in . 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 c-cp-output (See -x on page). But this does not work: I get it simply:

Prev> $ gcc -x c-cpp-output -std = c99 bar.c i686-apple-darwin9-gcc-4.0.1 : Language c-cpp-output not recognized i686-apple-darwin9-gcc-4.0.1: Language c-cp-output was not recognized by LD warning: In bar.c, the file is not necessarily the architecture of the undetermined symbols: "_main", referenced from: starting in crt1.10.5. O LD: Symbol (s) not found Collection 2: Exit status of LD back 1

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

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -