News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

How to get the C generated code ?

Started by R1S8K, May 15, 2021, 12:25:32 PM

Previous topic - Next topic

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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

R1S8K

Sorry I forgot to mention that I use Windows 10.

QuoteThe easiest way is to do a build of the file, copy the command, modify it and run it in terminal.

Can this  be done in Windows ?

oBFusCATed

Yes. The principles and operation is the same on all OSes (mostly).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

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