0

I am a complete programming (and generally IT) noob and I am learning C++ using Visual Studio environment. I would like to explore the compiler, and see my temporary files (ending with .ii, .s and .o).

My textbooks tell me to instruct the compiler to save using the -save-temps option. What I don't understand is how do I actually access this -save-temps option? Is there some toggle option I click in Visual Studio to do this? Where do I find it? Please bear in mind I am completely new to the Visual Studio environment.

Alex
  • 139
  • 6
  • 1
    That's a GCC option, not a VS option. And it's not really useful for learning C++ - which textbooks are you getting this stuff from? –  Mar 18 '19 at 15:55
  • Ok; a textbook which has a section on exploring compiler is "C++ programming" by Mike McGrath - he uses GNU compiler. But I thought this option is available regardless of the development environment. For what it's worth, I have CodeBlocks, for which I also have no clue how to access these temp files @NeilButterworth – Alex Mar 18 '19 at 16:01
  • i think that inside the Debug folder of your Project there might be a .o file but i am not sure as i have not used VS for a long time. – Geo Angelopoulos Mar 18 '19 at 16:21

1 Answers1

-2

You should use g++ (GNU C++ Compiler) to compile your source code and not Visual Studio.

To get .o files run g++ main.c -o main.o. This will give you the object file. It is incomprehensible as it is a binary file not a readable text file.

To get .s files run g++ -S main.c -o main.s. This will give you the assembly file. This file is readable as it is the assembly of your source code.

Geo Angelopoulos
  • 1,037
  • 11
  • 18