Menu

Dev-C++ Compiler Intermediate file

Drewsky
2006-07-06
2012-09-26
  • Drewsky

    Drewsky - 2006-07-06

    Can anyone let me know how examine the intermediate file (non- assembler code) after compilation and inclusion of the preprocessor directives? I'm using Dev-C++ version 4.9.8.3. Is there a switch in the IDE or must I use a switch at the command line?

     
    • Anonymous

      Anonymous - 2006-07-06

      What intermediate file are you referring to. It may help if you explain what it is you are trying to find out.

      The translation sequence is as follows:

      source -> pre-processed source -> assembler code -> object code

      Your request ("non-assembler", but "after compilation and pre-processing"), could only refer to the object code - but that is the final file of compilation, not an "intermediate file". The object code is then used by the linker to generate an executable, so perhaps that is what you mean?

      object code + libraries -> executable

      In GCC object code has the .o extension. They are not temporary files, they remain on your filesystem after the build process completes. They are not generated if the compilation fails.

      Clifford

       
    • Drewsky

      Drewsky - 2006-07-06

      Hi Clifford, thanks for the reply. My mistake, I shouldn't have said after compilation. It's the preprocessed source code I'm after. I believe you can access this intermediate file with a switch in the IDE or on the command line.

       
    • Anonymous

      Anonymous - 2006-07-06

      The -E option (which can be entered in your project compiler options within teh IDE) means "Stop after the preprocessing stage". Unfortunately because it stops rather than simply retaining the file, a normal build will fail, because the target for each compilation unit is a .o file which is not created.

      This is not a problem for single source projects, because it fails after the file is generated. However for multiple source projects only the first file will be preprocessed.

      One solution is to take the noremal generated makefile.win file for your project, modify it and use it as a custom make file.

      Another alternative is to simply run the compiler from the command line.

      It is also possible to run the c-preprocesser independently of the compiler using cpp.exe, you need to pass all the same -I and -D parameters that you pass to normal compilation - some other options also affect predefined built-in macros, so you might pass all the same parameters you pass to the compiler to the pre-processor - it will ignore any irellevent parameters. You can copy & paste the required parameters from the compile log of a normal IDE build.

      http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Overall-Options.html#Overall-Options
      http://gcc.gnu.org/onlinedocs/cpp/

      Note that for code that includes standard library or Win32 headers for example the pre-processor output can be very large and almost unreadable. I suggest that you embed a comment in your code that you can search on to find your code omongst the output.

      Clifford

       
    • Drewsky

      Drewsky - 2006-07-09

      Thanks for your help Clifford.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.