tags:

views:

81

answers:

4

Are there any IDE's or plugins to one that will expand/preprocess a macro and show their results inline without compiling?

I've found a couple of other questions that are related, but they require compiling.

+2  A: 

On a Unix-like platform, you can use cpp (the C preprocessor) on a file to get that result.

Harper Shelby
not quite what i'm looking for, but it seems like this is as close as i'll get. thanks
pxl
A: 

Just have your IDE run the preprocessor, but the not the compiler, assembler, or linker.

Bob Somers
+4  A: 

Most compilers offer you the option to do that. Different compilers will have different switches though. Consult your docs.

For example, with Microsoft C++ compilers that would be /E /EP and /P command-line switches. They can be specified from within their IDE as well. These switches also disable compilation, just as you wanted.

AndreyT
visual studio will generate a *.i file - an intermediate file, in the same directory. look at the contents of that file.
sean riley
that'll do it. thanks
pxl
A: 

For gcc it will be -E

dimba
this would require running gcc. is there any software that will show the expanded macro inline while editing/viewing the source code?
pxl
You can add it to the compiler flags in the IDE. I'm not sure if -E is the right flag or not, but there should be a flag to generate a file with the preprocessed code. You can then just open it in your editor.OR, just assign the gcc -E command to a tool button/tool menu in your (reasonably good) IDE, set it to display the command output, and run that tool on your open file whenever you need to.
Lee B