Home Ask Login Register

Developers Planet

Your answer is one click away!

Il Divin Codino February 2016

C/C++: source file after preprocessing-Diab compiler?

source.c --(preprocessing)--> temp_source.c --(compiling)--> source.elf --(linking)--> source.exe

How to view temp_source.c ?

(I just assume that this file name temp_source.c)

Edit: I'm using Diab compiler.


the flash February 2016

Command line interface to Microsoft Visual C++ can be used to output the preprocessed file as :

/E: preprocess to stdout (similar to GCC's -E option)
/P: preprocess to file
/EP: preprocess to stdout without #line directives

Robert Larsen February 2016

The gcc preprocessor is called cpp

$ cpp -o preprossed_temp.c temp.c

GTKM February 2016

If you use GCC, just write:

gcc -E source.c -o temp_source.c

Mozfox February 2016

On Windows

Compiler will create a intermediate file with default extension (.i)

cl /P source.c 

Compiler will redirect to stdout

cl /E source.c

cl /E source.c > source.txt

On Linux

$gcc -E source.c > source.txt

Post Status

Asked in February 2016
Viewed 1,175 times
Voted 7
Answered 4 times


Leave an answer

Quote of the day: live life