<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> | |
<title>Installing and Configuring C/C++ Support - NetBeans IDE 6.0 Tutorial</title> | |
<meta name="DESCRIPTION" content="Installing and Configuring C/C++ Support - NetBeans IDE 6.0 Tutorial"> | |
<meta name="author" content="Ann Rice"><!--Optional tag--> | |
<link rel="stylesheet" type="text/css" href="https://netbeans.org/netbeans.css"> | |
</head> | |
<body> | |
<a name="top"></a> | |
<h1>Installing and Configuring C/C++ Support</h1> | |
<!-- START INTRO ---------------------------------------------------------------------------------------* --> | |
<div class="articledate" style="margin-left: 0px;font-style:italic;"> | |
<p><em>Contributed and maintained by <a href="mailto:ann.rice@sun.com"><i>Ann | |
Rice</i></a><br> | |
September 2007</em> [Revision number: V6.0-1]</div> | |
<p>This document provides | |
information on downloading, installing, and configuring C/C++ support in the | |
NetBeans IDE.</p> | |
<!-- END INTRO --> | |
<h3>Contents</h3> | |
<img src="../../../images_www/articles/60/netbeans-stamp60-61.gif" class="stamp" | |
alt="Content on this page applies to NetBeans IDE 6.0 and NetBeans IDE 6.1" | |
title="Content on this page applies to the NetBeans IDE 6.0 and NetBeans IDE | |
6.1"> | |
<table class="b-none" cellpadding="0" cellspacing="0" class="vatop"> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#downloading" title="Downloading C/C++ Support">Downloading C/C++ | |
Support</a></td> | |
</tr> | |
<tr> | |
<td><class="hyphen">- </td> | |
<td><a href="#compilers" title="Installing and Setting Up the Compilers and | |
Tools">Installing and Setting Up the Compilers and Tools</a></td> | |
</tr> | |
<tr> | |
<td><class="hyphen">- </td> | |
<td><a href="#verifying" title="Verifying the Installation">Verifying the | |
Installation</a> | |
</td> | |
</tr> | |
</table> | |
<br> | |
<!-- DOWNLOADING ----------------------------------------------------------> | |
<h2><a name="downloading">Downloading C/C++ Support</a></h2> | |
<br> | |
<p>If you do not have the NetBeans 6.0 IDE, go to the | |
<a href="http://download.netbeans.org/netbeans/6.0/final/ ">NetBeans IDE | |
6.0 Download Page</a>, and download | |
a version of the IDE that contains C/C++ support. | |
If you have a NetBeans IDE 6.0 installation that does not include | |
C/C++ support, | |
complete the following steps to add C/C++ support to the IDE.</p> | |
<ol> | |
<li>If your network uses a proxy, choose Tools > Options from the main | |
menu, select Manual Proxy Settings, enter the HTTP Proxy and Port for | |
your proxy, and click OK.</li> | |
<li>Choose Tools > Plugins from the main menu.</li> | |
<li>In the Plugins dialog box, click the Available Plugins tab, | |
and scroll to the C/C++ category. | |
</li> | |
<li>Select the C/C++ checkbox. | |
<li>Click Install.<br> | |
<br>The NetBeans IDE Installer starts.</li> | |
<li>In the NetBeans IDE Installer, click Next.</li> | |
<li>Read the license agreement, then select the I Accept the Terms in All | |
License Agreements radio button, and click Next.</li> | |
<li>Click Install.</li> | |
<li>After the installation completes, select either Restart IDE Now or Restart | |
IDE Later and click Finish.</li> | |
</ol> | |
<br> | |
<!-- COMPILER SETUP -------------------------------------------------------> | |
<h2><a name="compilers">Installing and Setting Up the Compilers and Tools</a></h2> | |
<p>Netbeans C/C++ pack requires a C compiler, C++ compiler, | |
<tt>make</tt> utility, and <tt>gdb</tt> debugger. | |
</p> | |
<!-- COMPILER SETUP: WINDOWS ----------------------------------------------> | |
<blockquote> | |
<h3 style="color:#0E1B55"><a name="compilers_windows"></a>Windows</h3> | |
<p>NetBeans C/C++ pack has been tested with the following compilers | |
and tools: | |
<ul> | |
<li>Cygwin 1.5.21</li> | |
<li>Cygwin gcc-core (C compiler) 3.4.x</li> | |
<li>Cygwin gcc-c++ (C++ compiler) 3.4.x</li> | |
<li>Cygwin gdb (GNU Debugger) 6.5.50</li> | |
<li>Cygwin make 3.80</li> | |
</ul> | |
</p> | |
<p>If you already have the Cygwin GNU compilers, GNU <tt>make</tt>, and | |
<tt>gdb</tt> debugger installed on your Windows system and | |
your path is set up correctly to find them, make sure that you have the | |
correct versions. If you have the correct versions, then no further setup is | |
necessary. | |
</p> | |
<blockquote> | |
<p><b>To check the versions of your Cygwin compilers and tools:</b> | |
<ol> | |
<li> | |
<p>Check the version of Cygwin by typing: | |
<pre> | |
cygcheck -c cygwin | |
</pre> | |
</li> | |
<li>Check the versions of the compilers, <tt>make</tt>, and <tt>gdb</tt> by | |
typing: | |
<pre> | |
gcc --version | |
g++ --version | |
make --version | |
gdb --version | |
</pre> | |
</li> | |
</ol> | |
<p><b>To install the GNU compilers, <tt>make</tt>, and <tt>gdb</tt> debugger from | |
<a href="http://cygwin.com">cygwin.com</a>:</b></p> | |
<ol> | |
<li>Download the Cygwin <a href="http://www.cygwin.com/setup.exe"> | |
<tt>setup.exe</tt></a> program by clicking the Install or Update Now! | |
icon in the middle of the page. | |
</li> | |
<li> | |
Run the <tt>setup.exe</tt> program. Accept the defaults until you reach | |
the Select Your Internet Connection page. Select the option on this | |
page that is best for you. Click Next. | |
</li> | |
<li> | |
On the Choose Download Site page, choose a download site you think | |
might be relatively close to you. Click Next. | |
</li> | |
<li> | |
On the Select Packages page you select the packages to download. Click | |
the + next to Devel to expand the development tools category. You may | |
want to resize the window so you can see more of it at one time. | |
</li> | |
<li> | |
Select each package you want to download by clicking the Skip label | |
next to it. At a minimum, select gcc-core: C compiler, | |
gcc-g++: C++ compiler, gdb: The GNU Debugger, and make: the GNU | |
version of the 'make' utility. | |
</li> | |
<li> | |
Now add the Compiler directory to your path: | |
<br><br> | |
<ol type="a"> | |
<li>Open the Control Panel (Start > Settings > Control Panel) and | |
double-click the System program.</li> | |
<li>Select the Advanced tab and click Environment Variables.</li> | |
<li>In the System Variables panel of the Environment Variables dialog, | |
select the <tt>Path</tt> variable and | |
click Edit.</li> | |
<li>Add the path to the | |
<tt><i>cygwin-directory</i>\bin</tt> directory to the <tt>Path</tt> variable, and | |
click OK. By default, <tt><i>cygwin-directory</i></tt> is | |
<tt>C:\cygwin</tt>. Directory names must be separated with a semicolon.</li> | |
<li>Click OK in the Environment Variables dialog and the System | |
Properties dialog. | |
</li> | |
</ol> | |
</li> | |
</ol> | |
</blockquote> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br> | |
<!-- COMPILER SETUP: SOLARIS OS --------------------------------> | |
<h3 style="color:#0E1B55"><a name="compilers_solaris"></a>Solaris OS</h3> | |
<p> | |
NetBeans C/C++ pack has been tested with the following compilers | |
and tools: | |
<ul> | |
<li>Sun Studio 12 C compiler 5.9 and gcc 3.4.3</li> | |
<li>Sun Studio 12 C++ compiler 5.9 and g++ 3.4.3</li> | |
<li>gdb (GNU debugger) 6.2.1</li> | |
<li>Solaris make and gmake 3.80</li> | |
</ul> | |
<h4>Sun Studio 12 Compilers</h4> | |
<p>If you want to use the Sun Studio 12 compilers: | |
<ul> | |
<li>If you | |
have Sun Studio 12 software installed, ensure that <tt>/<i>installation | |
directory</i>/SUNWspro/bin</tt> | |
is in your path before you start the NetBeans IDE.</li> | |
<li> | |
If you do not have Sun Studio 12 software installed, you can | |
download it free at <a href="http://developers.sun.com/sunstudio/downloads/"> | |
<tt>http://developers.sun.com/sunstudio/downloads/</tt></a>. | |
</li> | |
</ul> | |
</p> | |
<blockquote> | |
<p><b>To download and install the Sun Studio 12 compilers:</b></p> | |
<ol> | |
<li>Create a directory for the downloaded file. | |
You must have write permission for this directory.</li> | |
<li> | |
Download the file for your platform into the download directory. | |
</li> | |
<li>Go to the download directory, and uncompress and untar the downloaded file. | |
<pre> | |
bzcat <i>filename</i> | tar xvf - | |
</pre> | |
</li> | |
<!-- | |
<li> | |
Become superuser (root). Run the installer in the download directory by typing: | |
<pre> | |
./installer | |
</pre> | |
</li> | |
<br> | |
<li>Click Next on the Welcome page, and accept the Software License Agreement | |
and click Next. | |
</li> | |
<li>On the Select Components page of the installer, select Custom Install for | |
Sun Studio Software. Select Default Install for Solaris Patches. Select No Install for | |
Documentation, Source Distribution, and Sun Performance Library. | |
</li> | |
<li>On the Select Install Directory page, if you want to install the compilers | |
in the default installation directory <tt>/opt</tt>, click Next. If you want to | |
install the compilers in a different directory, type the path in the text field | |
and click Next.</li> | |
<li>On the Select Subcomponents page, select Compilers C and | |
Compilers C++, and click Next. | |
</li> | |
<li>On the Ready to Install page, verify that the disk space shown is available | |
on your system, and that the C compiler, C++ compiler, and Solaris patches are | |
listed. Then click Install Now. | |
</li> | |
<li>When installation is complete, proceed through the Installation Summary | |
page, the Registration page, and the After Installation page, and click Exit to | |
exit the installer. | |
</li> | |
--> | |
<li>Follow the instructions in <a | |
href="http://docs.sun.com/app/docs/doc/820-2971/gemyi?a=view">Chapter 2 of the <i>Sun | |
Studio 12 Quick Installation (English, Japanese, Simplified Chinese)</i> | |
guide</a> to install the C compiler, C++ compiler, | |
and required Solaris patches.</li> | |
</ol> | |
</blockquote> | |
<p>Add the path to the Sun Studio software to your <tt>PATH</tt> before | |
starting the NetBeans IDE. | |
</p> | |
<h4>GNU Compilers and GNU <tt>make</tt></h4> | |
<p> | |
If you want to use the GNU compilers and GNU <tt>make</tt>: | |
<ul> | |
<li>If you have a standard installation of the Solaris 10 OS, the compilers and | |
<tt>gmake</tt> are installed in <tt>/usr/sfw/bin</tt>. Make sure that this | |
location is in your path before staring the NetBeans IDE.</li> | |
<li>If the compilers and <tt>gmake</tt> are not installed on your system, you can download them from | |
<a | |
href="http://www.sunfreeware.com"><tt>http://www.sunfreeware.com</tt></a>.</li> | |
</ul> | |
<blockquote> | |
<p><b>To download and install the GNU compilers and make</b></p> | |
<ol> | |
<li>Download gcc 3.4.6 and make 3.81.</li> | |
<li>If the download zip files are not | |
automatically gunzipped during download, unzip them with <tt>gunzip</tt>. | |
</li> | |
<li>Install the packages with the <tt>pkgadd</tt> command.</li> | |
</ol> | |
</blockquote> | |
<p>Make sure to include the GNU | |
compiler directory and the GNU make directory in your path before starting the NetBeans IDE. | |
</p> | |
<h3><tt>gdb</tt> Debugger</h3> | |
<p>Whether you use the Sun Studio compilers and Solaris <tt>make</tt> or the | |
GNU compilers and GNU <tt>make</tt>, you must have the <tt>gdb</tt> debugger to | |
debug applications in NetBeans C/C++ Development Pack. You can download <tt>gdb</tt> 6.2.1 from | |
<a href="ftp://ftp.gnu.org/gnu/gdb/"><tt>ftp://ftp.gnu.org/gnu/gdb/</tt></a>. | |
</p> | |
<blockquote> | |
<p><b>To download and install <tt>gdb</tt>:</b></p> | |
<ol> | |
<li>Under "Select a Download" at the botttom of the page, select the Solaris 10 | |
Companion Software download for your Solaris platform.</li> | |
<li>On the Download page, accept the License Agreement and select the | |
<tt>gdb - GNU source level debugger</tt> package. | |
</li> | |
<li>Become root (superuser). | |
</li> | |
<li>Unzip the file with <tt>binzip</tt> and install <tt>gdb</tt> with | |
<tt>pkgadd</tt>: | |
<pre> | |
bunzip2 SFWgdb.bz2 | |
pkgadd -d SFWgdb | |
</pre> | |
</li> | |
</ol> | |
</blockquote> | |
<p>Make sure to include the path to <tt>gdb</tt> in your path before starting | |
the NetBeans IDE.</p> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br> | |
<!-- COMPILER SETUP: LINUX OS --------------------------------> | |
<h3 style="color:#0E1B55"><a name="compilers_linux"></a>Linux</h3> | |
<p> | |
NetBeans C/C++ pack has been tested with the following compilers | |
and tools: | |
<ul> | |
<li>Sun Studio 12 C compiler, Red Hat Fedora Core 3 gcc, and Ubuntu 6.10 and 7.04 gcc</li> | |
<li>Sun Studio 12 C++ compiler, Red Hat Fedora Core 3 g++, and Ubuntu 6.10 and 7.04 g++</li> | |
<li>Red Hat Fedora Core 3 gdb and Ubuntu 6.10 and 7.04 gdb</li> | |
<li>Red Hat Fedora Core make and Ubuntu 6.10 and 7.04 make</li> | |
</ul> | |
</p> | |
<blockquote> | |
<p><b>To download and install the Sun Studio 12 compilers:</b></p> | |
<ol> | |
<li>Create a directory for the downloaded file. | |
You must have write permission for this directory.</li> | |
<li> | |
Download the file for your platform into the download directory. | |
</li> | |
<li>Go to the download directory, and uncompress and untar the downloaded file. | |
<pre> | |
bzcat <i>filename</i> | tar xvf - | |
</pre> | |
</li> | |
<li>Follow the instructions in <a | |
href="http://docs.sun.com/app/docs/doc/820-2971/gemyi?a=view">Chapter 2 of the <i>Sun | |
Studio 12 Quick Installation (English, Japanese, Simplified Chinese)</i> guide</a> to install the C compiler, C++ compiler, | |
and required Solaris patches.</li> | |
</ol> | |
</blockquote> | |
<p>Add the path to the Sun Studio software to your <tt>PATH</tt> before | |
starting the NetBeans IDE. | |
</p> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br> | |
<!-- COMPILER SETUP: MAC OS X ----------------------------------> | |
<h3 style="color:#0E1B55"><a name="compilers_mac"></a>Macintosh OS X</h3> | |
<p> | |
NetBeans C/C++ pack has been tested with the following compilers | |
and tools: | |
<ul> | |
<li>gcc 4.0.1 compilers</li> | |
<li>gdb (GNU debugger) 6.1</li> | |
</ul> | |
<p>Install the following packages that are provided with your Macintosh OS X: | |
<ul> | |
<li>Xcode</li> | |
<li>X11</li> | |
</ul> | |
</blockquote> | |
</blockquote> | |
<br> | |
<p align="center"><a href="#top">top</a></p> | |
<br><!-- VERIFYING THE INSTALLATION ------------------------------------------> | |
<h2><a name="verifying">Verifying the Installation</a></h2> | |
<p>To verify that the installation is correct, start the NetBeans IDE, | |
build a sample project, and run it in the <tt>gdb</tt> debugger.</p> | |
<blockquote> | |
<h3 style="color:#0E1B55"><a name="verify_windows">Windows</a></h3> | |
<p><b>To start the IDE on Microsoft Windows machines, do one of the following:</b></p> | |
<ul> | |
<li>Double-click the NetBeans IDE icon on your desktop.</li> | |
<li>From the Start menu, select Programs > NetBeans 6.0 > NetBeans | |
IDE.</li> | |
</ul> | |
<p><b>To build a sample project and run it in the debugger:</b> | |
<ol> | |
<li>Open the New Project wizard by choosing File > New Project.</li> | |
<li>In the Categories panel on the Choose Project page of the wizard, expand the Samples category and the C/C++ Development | |
subcategory, and select the C/C++ subcategory.</li> | |
<li>In the Projects panel, select the <tt>Welcome</tt> project. Click Next. | |
</li> | |
<li>On the Project Name and Location page, click Finish. | |
</li> | |
<li>In the Projects tab of the IDE, right-click the <tt>Welcome_1</tt> project and | |
choose Build Project. If your compilers and <tt>make</tt> utility are | |
installed correctly and the path to them is set, build output is displayed in | |
the Output window and the project builds successfully. | |
</li> | |
<li>Double-click the <tt>welcome.cc</tt> file to open it in the Source | |
Editor.</li> | |
<li>Right-click in the left margin of the Source Editor window and choose | |
Show Line Numbers. | |
</li> | |
<li>Set a breakpoint by clicking in the left margin of the Source | |
Editor window next to line 33. | |
</li> | |
<br> | |
<li>Right-click the project and choose Debug Project. If the <tt>gdb</tt> | |
debugger is installed correctly and the path to it is set, <tt>gdb</tt> starts | |
up, the Debugger tabs are displayed, and the </tt>Welcome</tt> application | |
runs and stops at the breakpoint. | |
</li> | |
<li>Choose Run > Continue to run the application to completion. | |
</li> | |
</ol> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br><h3 style="color:#0E1B55"><a name="verify_solaris">Solaris OS</a></h3> | |
<p><b>To start the NetBeans IDE on Solaris systems:</b></p> | |
<ol> | |
<li>Navigate to the <tt>bin</tt> subdirectory of your installation. </li> | |
<li>Execute the launcher script by typing <tt>./netbeans</tt>. | |
</ol> | |
<p><b>To build a sample project and run it in the debugger:</b> | |
<ol> | |
<li>Open the New Project wizard by choosing File > New Project.</li> | |
<li>In the Categories panel on the Choose Project page of the wizard, expand the Samples category and the C/C++ Development | |
subcategory, and select the C/C++ subcategory.</li> | |
<li>In the Projects panel, select the <tt>Welcome</tt> project. Click Next. | |
</li> | |
<li>On the Project Name and Location page, click Finish. | |
</li> | |
<li>In the Projects tab of the IDE, right-click the <tt>Welcome_1</tt> project | |
and choose Properties. | |
</li> | |
<li>In the Project Properties dialog box, set the Compiler Collection property | |
to the compiler collection you want to validate and click OK. | |
</li> | |
<li>In the Projects tab, right-click the project and | |
choose Build Project. If your compilers and <tt>make</tt> utility are | |
installed correctly and the path to them is set, build output is displayed in | |
the Output window and the project builds successfully. | |
</li> | |
<li>Double-click the <tt>welcome.cc</tt> file to open it in the Source | |
Editor.</li> | |
<li>Right-click in the left margin of the Source Editor window and choose | |
Show Line Numbers. | |
</li> | |
<li>Set a breakpoint by clicking in the left margin of the Source | |
Editor window next to line 33. | |
</li> | |
<li>Right-click the project and choose Debug Project. If the <tt>gdb</tt> | |
debugger is installed correctly and the path to it is set, <tt>gdb</tt> starts | |
up, the Debugger tabs are displayed, and the </tt>Welcome</tt> application | |
runs and stops at the breakpoint. | |
</li> | |
<li>Choose Run > Continue to run the application to completion. | |
</li> | |
</ol> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br> | |
<h3 style="color:#0E1B55"><a name="verify_linux">Linux</a></h3> | |
<p><b>To start the NetBeans IDE on Linux systems:</b></p> | |
<ol> | |
<li>Navigate to the <tt>bin</tt> subdirectory of your installation. </li> | |
<li>Execute the launcher script by typing <tt>./netbeans</tt>. | |
</ol> | |
<p><b>To build a sample project and run it in the debugger:</b> | |
<ol> | |
<li>Open the New Project wizard by choosing File > New Project.</li> | |
<li>In the Categories panel on the Choose Project page of the wizard, expand the Samples category and the C/C++ Development | |
subcategory, and select the C/C++ subcategory.</li> | |
<li>In the Projects panel, select the <tt>Welcome</tt> project. Click Next. | |
</li> | |
<li>On the Project Name and Location page, click Finish. | |
</li> | |
<li>In the Projects tab of the IDE, right-click the <tt>Welcome_1</tt> project | |
and choose Properties. | |
</li> | |
<li>In the Project Properties dialog box, set the Compiler Collection property | |
to the compiler collection you want to validate and click OK. | |
</li> | |
<li>In the Projects tab, right-click the project and | |
choose Build Project. If your compilers and <tt>make</tt> utility are | |
installed correctly and the path to them is set, build output is displayed in | |
the Output window and the project builds successfully. | |
</li> | |
<li>Double-click the <tt>welcome.cc</tt> file to open it in the Source | |
Editor.</li> | |
<li>Right-click in the left margin of the Source Editor window and choose | |
Show Line Numbers. | |
</li> | |
<li>Set a breakpoint by clicking in the left margin of the Source | |
Editor window next to line 33. | |
</li> | |
<li>Right-click the project and choose Debug Project. If the <tt>gdb</tt> | |
debugger is installed correctely and the path to it is set, <tt>gdb</tt> starts | |
up, the Debugger tabs are displayed, and the </tt>Welcome</tt> application | |
runs and stops at the breakpoint. | |
</li> | |
<li>Choose Run > Continue to run the application to completion. | |
</ol> | |
<br><p align="center"><a href="#top">top</a></p> | |
<br> | |
<h3 style="color:#0E1B55"><a name="verify_mac">Mac OS X</a></h3> | |
<p><b>To start the IDE on Macintosh machines, double-click the NetBeans icon on your desktop.</li> | |
<p>To build a sample project and run it in the debugger:</b> | |
<ol> | |
<li>Open the New Project wizard by choosing File > New Project.</li> | |
<li>In the Categories panel on the Choose Project page of the wizard, expand the Samples category and the C/C++ Development | |
subcategory, and select the C/C++ subcategory.</li> | |
<li>In the Projects panel, select the <tt>Welcome</tt> project. Click Next. | |
</li> | |
<li>On the Project Name and Location page, click Finish. | |
</li> | |
<li>In the Projects tab of the IDE, right-click the <tt>Welcome_1</tt> project and | |
choose Build Project. If your compilers and <tt>make</tt> utility are | |
installed correctly and the path to them is set, build output is displayed in | |
the Output window and the project builds successfully. | |
</li> | |
<li>Double-click the <tt>welcome.cc</tt> file to open it in the Source | |
Editor.</li> | |
<li>Right-click the project and choose Debug Project. If the <tt>gdb</tt> | |
debugger is installed correctly and the path to it is set, <tt>gdb</tt> starts | |
up and the Debugger tabs are displayed. | |
</li> | |
</ol> | |
</blockquote> | |
<br><p align="center"><a href="#top">top</a></p> | |
<!-- NEXT STEPS --> | |
<br> | |
<h2>Next Steps</h2> | |
<p>To learn quickly how to develop a C or C++ application with the NetBeans | |
IDE, see the <a href="../../../kb/61/cnd/projects-quick-start.html">C/C++ | |
Projects Quick Start Tutorial</a> | |
</p> | |
<!-- End Content Area --> | |
</div> | |
</td> | |
</tr> | |
</table> | |
</body> | |
</html> |