LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Regarding compiling a program with different options (https://www.linuxquestions.org/questions/linux-newbie-8/regarding-compiling-a-program-with-different-options-801797/)

Ajit Gunge 04-13-2010 01:27 PM

Regarding compiling a program with different options
 
I am suing RHEL.I have a small C/Cpp program and I am trying the possible combinations during compilations that I can use.I want to see the output of all the options I am trying to redirect this output in a file but I dont get to see the output in the file.This is what I am trying to do

My c program is named as prog4.cpp

Quote:

#include<iostream>
static int Code;
int code2;
int main (void)
{
printf("Value is %d",Code);
printf("Value is %d",code2);
return 0;
}
now I am compiling this program with multiple options of g++ such as -Wall,-fno-inline etc etc I want to see the individual output for these options but I cannot see it in the file that I am redirecting the output to.Can someone help?

Thanks Regards,
Ajit

Ajit Gunge 04-13-2010 01:39 PM

Sorry the word is using and not suing

modprob 04-13-2010 01:42 PM

It's not possible to see the effects of those options in something other than the compiled file. You can direct GCC to compile the C file and stop at the assembly. By comparing the assembly files, you might see the effects of the options.

If that's what you're after, try this command
Code:

gcc -S -o output.asm input.c

Ajit Gunge 04-13-2010 01:53 PM

Hi Modprob.I tried your suggestion but I dont see much difference in the two asm files that I run with with the options.

Thanks for letting me know the -S option though:)

modprob 04-13-2010 01:55 PM

The fno-inline option is a hint to GCC. It can choose to ignore it.


All times are GMT -5. The time now is 03:33 AM.