How to get preprocessed code from Dev-c++ under Windows XP?

时光毁灭记忆、已成空白 提交于 2020-01-05 04:24:16

问题


How to get preprocessed C++ code from DevC++ under Windows XP? I've read about creating gcc -E file.cpp file, but I still can't connect the dots, how to run this file? After I've compiled it everything went as usual.


回答1:


You simply can't 'run' a preprocessed file. You can just compile and run it, or inspect it for what the preprocessor produced.

E.g. when using GCC you can run

gcc file.cpp -E <all preprocessor options as set from the IDE> -o file_preprocessed.cpp

to get the file_preprocessed.cpp file for inspection.

I don't know for the dev-c++ IDE in particular, but usually you'll get a representation of the actually used compiler flags of a project in the project settings somewhere.




回答2:


run

gcc file.cpp -E -o file_preprocessed.cpp

then you can open file_preprocessed.cpp to see the output



来源:https://stackoverflow.com/questions/15119998/how-to-get-preprocessed-code-from-dev-c-under-windows-xp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!