Can any of known compilers output the result of pre pocessor?
For example:Result will beCode:#define d
#ifdef d
cout<<"ok";
#else
cout<<"no";
#end if
Code:cout<<"ok";
Printable View
Can any of known compilers output the result of pre pocessor?
For example:Result will beCode:#define d
#ifdef d
cout<<"ok";
#else
cout<<"no";
#end if
Code:cout<<"ok";
Yes, you could run something like this through the pre-compiler:
$ g++ -E foo.cc > output.txtCode:#define d
#ifdef d
#define STR "OK"
#else
#define STR ""
#endif
#include <iostream>
int main ( ) {
std::cout << STR;
}
It dumps a whole lot of stuff though, the standard header files are gigantic. You could do something clever to avoid it I suppose.
It is exactly what I want. I want to see all includes in one file.Quote:
It dumps a whole lot of stuff though, the standard header files are gigantic.
Anyway, it would just be a matter of reading your compiler's documentation to find out what switch you need to use and then writing a file that lets you see what you want to see.
Yes, it is exactly what I am doing. I didn't find any swtch in IDE options though and I am hopless.Quote:
Originally Posted by citizen
I found it. I don't know why I didn't see it before. It is /P in my compiler.
Thank you.