Vijay
Vijay

Reputation: 67221

Is there a way to look at the preprocessor expanded file in C

I want to know how could we look at the C file after it has been expanded by the preprocessor before compilation with all the macro values put in the code inside the function where ever they are used. Is there a way to do it?

Upvotes: 1

Views: 226

Answers (2)

user181548
user181548

Reputation:

Just run it through cpp:

cpp file.c

Upvotes: 7

Arkaitz Jimenez
Arkaitz Jimenez

Reputation: 23178

You can ask gcc to do it for you gcc -E yourfile.cpp

That will expand macros and include files, all the preproccessing.

Upvotes: 14

Related Questions