User forums > Using Code::Blocks

How to get the C generated code ?

(1/1)

R1S8K:
Hi,

I'm using macros and having problem knowing how the code works. So one told me to use a flag that output the expanded generated code.

But I don't know how to use it in codeblocks.

oBFusCATed:
We don't have anything integrated for the task.
The easiest way is to do a build of the file, copy the command, modify it and run it in terminal.
If you do this often you can set up a tool for it.

Here are some hints about the flags needed: https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines

R1S8K:
Sorry I forgot to mention that I use Windows 10.


--- Quote ---The easiest way is to do a build of the file, copy the command, modify it and run it in terminal.
--- End quote ---

Can this  be done in Windows ?

oBFusCATed:
Yes. The principles and operation is the same on all OSes (mostly).

BlueHazzard:
Quick, easy and dirty you can add the -E flag in Project->Build options->Compiler settings->other compiler options

If you hit compile now, the generated object file (with the file ending .o in PROJECT_FOLDER/obj/BUILD_TARGET_NAME/SOURCE_FILE_NAME.o) will contain the preprocessed source. You can open it with any text editor you like. Linking will fail obviously. To compile the program again you have to remove the -E flag and make a rebuild: Build->Rebuild

Navigation

[0] Message Index

Go to full version