Search code examples
c++cmakecompilationpreprocessor-directive

How to see intermediate files created during C++ compilation process


When building an application in C++, I want to see all my intermediary files generated during the process like .o file, .i file, .asm file etc. But when I jump into explorer in windows, it shows nothing even after I try to show "hidden files". I tried to read one SO post but it is involving some CMake thing. Can these files be seen without using the CMake ? If yes How?


Solution

  • Just use the -save-temps compiler option. From the man page:

     -save-temps
          Store the usual "temporary" intermediate files permanently; name
          them as auxiliary output files, as specified described under
          -dumpbase and -dumpdir.
    

    There are a bunch of other options to influence which files and what name they will get. But for learning purposes that is usually more than enough.