views:

1174

answers:

2

The output we get when printing C++ sources from Eclipse is rather ugly.

Is there are way/a plugin to pretty print C++ source code like e.g. with a2ps (which is probably using yet another filter for C source code)?

+1  A: 

See this DDJ article which uses enscript as the pretty print engine.

epatel
+1  A: 

I also use enscript for this. Here's an alias I often use:

alias cpp2ps='enscript --color --pretty-print=cpp --language=PostScript'

and I use it like this:

cpp2ps -P main.ps main.cpp

There are several other great options in enscript including rotating, 2-column output, line numbers, headers/footers, etc. Check out the enscript man page.

Also, on Macs, XCode prints C++ code very nicely.

Pat Notz