Can’t open cygwin terminal after installation

Open the Cygwin Terminal properties (by right click on the icon and go to properties) check the path of ‘mintty’. If everything looks right and it is still giving error, change the ‘mintty’ to ‘mintty.exe’. This solved my problem.

How to install g++ in Cygwin?

Finally I could find the answer in this link. If one uses the MinGW installation file again, one can add some other packages. I installed all Devel packages for MinGW and followed this tutorial which helped me to solve the problem.