5

In Eclipse I would always use Ctrl + shift + f to autoformat code in the IDE.

Is there a similar feature in Dev-C++, or some plugin available that I can use for formatting my C/C++ code?

ChristianF
  • 1,735
  • 4
  • 28
  • 56
  • Since the accepted answer gives a commercial software as the solution, I'd like to disagree and add a free alternative that does the work - https://sourceforge.net/projects/astyle/files/ . One can use the same steps that are present in the accepted answer to use this formatter. – Sankalp Kotewar May 25 '21 at 07:02

1 Answers1

2

Instead of all this mentioned below, just Press Shift + Ctrl+ A

Download this.

http://www.formatcode.com/download.php

Format Source Code within Dev-C++

The following instructions allow you to format source code files in Dev-C++ using FormatCode command line tool.

Add a Tool Menu that will invoke FormatCode

  1. Click "Tools" -> "Configure Tools...".

  2. Click the "Add" button to add a new tool.

  3. Assuming you installed FormatCode in C:\Program Files\FormatCode, fill in the form as show below:

    Title: FormatCode Program: C:\Program Files\FormatCode\FormatCode.exe Working Directory: C:\Program Files\FormatCode
    Parameters: "SOURCENAME"

  4. Click "OK" button to save settings.

You may now invoke FormatCode command line tool:

  1. By clicking "Tools" -> "FormatCode".("AnyStyler)
Community
  • 1
  • 1
saruftw
  • 1,104
  • 2
  • 14
  • 37