Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I would like to know how to generate preprocessor file for all the source files in my project. For example, if my application contains only hello.c, I can use ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28

    Generating Preprocessor file

    Hi,

    I would like to know how to generate preprocessor file for all the source files in my project.

    For example, if my application contains only hello.c, I can use
    gcc -E hello.c > hello.i

    But if my application contains two files hello.c, hello_new.c how to generate preprocessor file individually?

    Thanks in Advance

  2. #2
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28
    Can anyone please help me to resolve this.

  3. #3
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Sure, be glad to.

    Your first step is to learn bash scripting. If you don't know how, google this:
    Code:
    bash tutorial
    It is very likely that someone else in this forum will jump in with his or her recommendation for a favorite tutorial, and that would be wonderful.

    Once you know bash scripting, then you're basically home. A handy tool is basename. For example, the command
    Code:
    basename hello.c .c
    outputs
    Code:
    hello
    So it will be easy to tack on the .i.

    Once you've become familiar with bash scripting, if you have difficulty, post your script as you've written it so far and come back with specific questions.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  4. #4
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28
    Hi,

    In my make file I used -save-temps option.
    Now I can able to generate .i files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...