"preprocess current file" addin for Visual Studio? (C ++)

I understand that Visual Studio has the "/ P" option to generate pre-processed files, but this is extremely inconvenient. I am looking for an add-on that allows you to right-click on a file and select "view preprocessed" - or any similar solution that will basically prepare the current file (with the appropriate parameters from the current configuration) and show me the output, without any extra hassle. Is there such a thing?

+7
c ++ visual-studio add-in
source share
4 answers

There is no really elegant way to do this using the External Tools menu, but here is a solution that will work:

  • Create a new configuration for your project. Call it something like "Debug-Preproc." In this configuration, set the / P switch for the compiler. (Preprocess, no compilation.)

  • Go to the setup menu of external tools. Create a new item called “Pre-Processing Project”. Set the following options:

    • Command: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
    • Arguments: $(ProjectDir)$(ProjectFileName) /Build "Debug-Preproc|Win32"

Now you can use the "Preprocess Project" option in your menu to start the preprocessor in all the source files in the currently selected project. It will generate [filename].i for each of them, which you can open in a text editor.

If you want, you can create an additional step to open the file in a text editor by adding a new external tool to your editor to open $(ItemFileName).i .

It’s not as simple or simple as the ability to right-click a file and select “preprocess”, but I think it’s best if you don’t write the extension.

+3
source share

In the user interface, you can configure the "External tool" (from the tool menu). You can create a tool that calls the compiler with the current file and the "/ P" option and displays the compiler. For an external tool, configure it to display in the output window.

+2
source share

Visual macros Expander : - addin for visual studio, it shows advanced macros and even result formats.

+1
source share

You compile proc using the same method in a C ++ project and an external build tool. you right-click on the proC file, and if the compiler command is installed in the Custom Build Setup program (in MS Visual Studio), it will show you the output of the C / C ++ file

0
source share

All Articles