Jump to content
  • Advertisement
Sign in to follow this  
Skeezix

C++ source code formatter for Visual studio 2008

This topic is 3585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

is there a source code formatter for Visual Studio 2008 in C++ mode??? i know there is a Format Selection thing there but for me it does not do its job well...is there a plugin or something where i can run inside VS2008 much like the one in code::blocks called Astyle(i think this does the job right)??? thanks for the replies

Share this post


Link to post
Share on other sites
Advertisement
You can also run astyle from the command line via Cygwin. If you need to run it in Visual Studio, you can probably just launch it as an external tool.

Share this post


Link to post
Share on other sites
There are a small selection of editor preferences in Visual Studio for things like tab size, fill tabs with spaces etc. I assume you're looking for something more than that, but just in case...

Share this post


Link to post
Share on other sites
@PKLoki yeah im looking for more than that...the formatting feature for C# in VS 2008 is better than in C++ why is that???

@Rydinare How can i do that?

@_fastcall is there a free thing like that?

Share this post


Link to post
Share on other sites
Quote:
Original post by Skeezix
@PKLoki yeah im looking for more than that...the formatting feature for C# in VS 2008 is better than in C++ why is that???

@Rydinare How can i do that?

@_fastcall is there a free thing like that?


You can download Cygwin here: www.cygwin.org

Cygwin gives you a lot of the Linux tools on Windows. It can be a pretty big install, though. Make sure to choose the astyle package when you install.

I usually just run from the command line, with options such as:

astyle --style=ansi -t -S filename1 .. filenamen

But, to embed this within Visual Studio, here's how you do it:

1) Go to Tools->External Tools.
2) Click Add
3) Make the title Astyle
4) Make the command: C:\cygwin\bin\astyle.exe (Assuming you installed Cygwin to C:\cygwin\bin)
5) Make the arguments: --style=ansi --style=ansi -t -S $(ItemPath) (Or whatever arguments you like. Check the arguments here: Astyle Documentation)
6) Click apply.

When you want to run on the file you currently have open, simply go to the Tools menu and click Astyle to use.

Share this post


Link to post
Share on other sites
Quote:
Make sure to choose the astyle package when you install.

If you did not do this, just install it using setup.exe file and select it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eagle11
I just installed cygwin and it did not have an Astyle.exe...


You didn't select the astyle package, so it wasn't installed. Run setup again.

Share this post


Link to post
Share on other sites
Quote:
Original post by Skeezix
@PKLoki yeah im looking for more than that...the formatting feature for C# in VS 2008 is better than in C++ why is that???


C# is exceptionally easier to parse (and thus make formatting/intellisense tools for) than C++.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!