If you are ever stuck in situation where you want to remove all the comments regardless of what they are in a source file. Here’s a small command that you can issue in VIM. It is for pattern search and replace using regex.
Open the file in VIM then
:g/\/\/.\+/s
Above command will look for anything after including the “//” characters which is basically a comment in C, C++, php and several other languages.