In Linux and Solaris NetBeans 6.5 configures itself using the gcc/g++ compiler which is available in several flavors of Linux to run C/C++ programs. However, in Windows, there isn’t any C/C++ compiler pre-installed, so we need to manually install a C/C++ compiler and configure NetBeans 6.5 with the compiler.
To achieve this, we use Cygwin - A Linux like environment for Windows. It contains several popular tools like gcc, g++, gmake, gdb, etc. Cygwin can be downloaded and installed from http://www.cygwin.com/.
Once the setup file is downloaded from the above mentioned site, it can be run as a normal .exe file. Cygwin supports three installation types -
- Online installation
- Downloading the installation files without actual installation
- Offline installation form a local directory
Mention the directory path for the installation files. Also mention the directory where the downloaded files were placed. Offline install requires the packages to be downloaded and stored as a directory.
The installer will collect information from the parse-file and list all the packages that are available for install. In online install, this will list all the packages that are available to be downloaded and installed. Select the required packages to be installed and proceed. After some time, the installation completes.
Once Cygwin is installed, NetBeans automatically recognizes it and configures its C/C++ compilers. However if it does automatically recognize Cygwin, go to Tools > Options. Under the C/C++ tab, set in the parameters by mentioning the path of the base directory (the bin directory of cygwin), C compiler (gcc), C++ compiler (g++), make command and the gdb command.
That’s all; NetBeans is now configured to run your C/C++ programs.