2

I'm trying to diagnose a problem with a preprocessor macro and thought I'd use /P (http://msdn.microsoft.com/en-us/library/8z9z0bx6.aspx) so I can see what it expands to.

Now, when I compile the .cpp file, I see a .i file temporarily appear next to it. I can't open the file as I get the error that it is locked by another process. Once the compile completes, the .i file seems to get automatically deleted again.

How can I see what the preprocessor macro expands to?

Thanks.

Scott Langham
  • 58,735
  • 39
  • 131
  • 204
  • Have a look here: http://stackoverflow.com/questions/277258/c-c-source-file-after-preprocessing – Haatschii Apr 16 '12 at 14:15
  • Thanks yes, the answers there are pretty much the steps that have got me as far as this particular problem (of the .i file disappearing before I can look at it). And, I have done this successfully in versions of VS pre VS2010. – Scott Langham Apr 16 '12 at 14:17
  • Have you tried the /E option as well? (This does not solve the problem of the disappering file, but it could tell you what your macro expands to) – Haatschii Apr 16 '12 at 14:19
  • Have you got any post build events that might be deleting them somehow? – GazTheDestroyer Apr 16 '12 at 14:21

1 Answers1

3

Ok, sorry, I'm being daft. When the .i file disappears, it isn't, it's actually being moved to the output folder.

Scott Langham
  • 58,735
  • 39
  • 131
  • 204