How can I see the output of the gcc preprocessor?

There are many cases where you need to see the output file of the GCC preprocessor to debug the code or error caused by macro or any preprocessor directive.

To solve this, you need to see the output file of the GCC after preprocessor.

To get it, you just need to give command:

  • GCC -E main.c 

Here I have taken main.c as a source file, you need to give your source file as an input to this command.

Then you can see the output file which has actually replaced the preprocessor directive with actual content. 

If this does not work then Try:

gcc -P main.c 
gcc -EP main.c 
gcc  /E main.c 
gcc  /P main.c 
gcc  /EP main.c

Related Post:

Removing Space from Given String & Different Methods to Count Number of Ones in Given Value

Booting Sequence for Boot Process in Linux

How to count number of 1 or set bits in a given number

What is Segmentation fault?

How to Access Private Data Members in C++ without using friend function

Process Vs Thread 

How to Add Two Numbers Without Using + Operator in C 

Overview of Function Pointer in C with Example - What is function pointer & how to use it

How to Fork child process with waitpid & execl in Linux with c example code

Share on Google Plus

About Kapil Thakar

"I am Kapil Thakar, an Embedded Engineer cum Blogger wants to learn new things. I love to share my knowledge solutions to the problems. Interested in Blogging, Creative-Writing, SEO, Website Creation, Video Making, Editing, Affiliation Programs, Online Making Money."
    Blogger Comment
    Facebook Comment


Post a Comment

Related Posts Plugin for WordPress, Blogger...