<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> | |
<title>Configuring the NetBeans IDE for C/C++/Fortran - NetBeans IDE 7.2</title> | |
<meta name="DESCRIPTION" content="Configuring the NetBeans IDE for C/C++/Fortran - NetBeans IDE 7.2"> | |
<link rel="stylesheet" type="text/css" href="../../../netbeans.css"> | |
</head> | |
<body> | |
<a name="top"></a> | |
<h1>Configuring the NetBeans IDE for C/C++/Fortran</h1> | |
<!-- START INTRO +++++++ --> | |
<div class="articledate" style="margin-left: 0px;font-style:italic;"><em>June 2012</em> [Revision number: V7.2-1]</div> | |
<p>This document provides | |
information about downloading, installing, and configuring C/C++ support in the | |
NetBeans IDE. Before you can develop in C/C++, the NetBeans IDE requires the | |
C/C++ plugin module, and third party C/C++ compilers, <code>make</code> utilities, and | |
debuggers. | |
</p> | |
<!-- END INTRO --> | |
<h3>Contents</h3> | |
<img src="../../../images_www/articles/72/netbeans-stamp.gif" class="stamp" alt="Content on this page applies to NetBeans IDE 7.2" title="Content on this page applies to the NetBeans IDE 7.2"> | |
<ul class="toc"> | |
<li><a href="#downloading" title="Enabling C/C++/Fortran in the IDE"> | |
Enabling C/C++/Fortran in the IDE</a></li> | |
<li><a href="#compilers" title="Installing and Setting Up the Compilers">Installing and Setting Up the Compilers and Tools</a></li> | |
<li><a href="#verifying" title="Verifying the Installation">Verifying the | |
Installation</a></li> | |
<li><a href="#ts" title="Troubleshooting Tool Issues">Troubleshooting Tool Issues</a></li> | |
</ul> | |
<p><b>To follow this tutorial, you need the following software and resources.</b></p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Required</th> | |
</tr> | |
<tr> | |
<td class="tbltd1">NetBeans IDE</td> | |
<td class="tbltd1"><a href="https://netbeans.org/downloads/index.html">version 7.2 with NetBeans C/C++ plugin</a></td> | |
</tr> | |
<tr> | |
<td class="tbltd1">Java Developer Kit (JDK)</td> | |
<td class="tbltd1"><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">version 6 and higher</a></td> | |
</tr> | |
</tbody> | |
</table> | |
<br> | |
<!-- DOWNLOADING ----------------------------------------------------------> | |
<h2><a name="downloading">Enabling C/C++/Fortran in the IDE</a></h2> | |
<p> | |
The NetBeans IDE is a dynamic modular IDE, which means you can change it by | |
adding and removing modules of the program. You can add functionality by | |
installing plugin modules, or remove functionality by uninstalling plugin modules. | |
See the NetBeans IDE online help for more information about plugins.</p> | |
<p> | |
If you want to work with C, C++, or Fortran programs in the NetBeans IDE, | |
your NetBeans installation must include the C/C++ plugin.</p> | |
<p class="tips">Although the plugin is named C/C++, it also includes support for Fortran | |
programming.</p> | |
<div class="indent"> | |
<h3>If you have not yet installed NetBeans IDE 7.2</h3> | |
<p>If you have not yet | |
installed the NetBeans IDE, download either the <b>C/C++</b> bundle or the | |
<b>All</b> bundle from <a href="https://netbeans.org/downloads/index.html">NetBeans IDE | |
7.2 Download Page</a>. If you will not be using other languages such as Java and Ruby, | |
you should download the C/C++ bundle.</p> | |
<h3>If you have NetBeans IDE 7.2 but do not know if you have the C/C++ plugin</h3> | |
<p>If you already have NetBeans IDE, determine if your NetBeans IDE includes the | |
C/C++ plugin already by selecting File > New Project. | |
If C/C++ is listed as one of the Categories, you have the C/C++ plugin module. | |
You should skip to the section <a href="#compilers">Installing and Setting Up the Compilers and Tools</a>. | |
</p> | |
<h3>If you have NetBeans IDE 7.2 without the C/C++ plugin</h3> | |
<p>If your NetBeans IDE does not show a C/C++ project category when you select | |
File > New Project, complete the | |
following steps to add the C/C++ plugin module to the IDE.</p> | |
<ol> | |
<li>If your network uses a proxy, choose Tools > Options > General in the IDE, | |
select Manual Proxy Settings, enter the HTTP Proxy and Port for | |
your proxy, and click OK.</li> | |
<li>Choose Tools > Plugins.</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 and click Install to start the NetBeans IDE Installer.</li> | |
<li>In the NetBeans IDE Installer, click Next.</li> | |
<li>Read the license agreement, select the checkbox to accept the terms | |
of the license agreement, 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> | |
</div> | |
<!-- COMPILER SETUP -------------------------------------------------------> | |
<h2><a name="compilers">Installing and Setting Up the Compilers and Tools</a></h2> | |
<p>The Netbeans C/C++ module requires a C compiler, C++ compiler, | |
<tt>make</tt> utility, and <tt>gdb</tt> debugger. See the following instructions for | |
the platform of your development system. | |
</p> | |
<table class="b-none vatop" cellpadding="0" cellspacing="0"> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#compilers_windows" title="Windows Platform">Microsoft Windows</a></td> | |
</tr> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#compilers_solaris" title="Solaris Platform">Oracle Solaris OS</a></td> | |
</tr> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#compilers_linux" title="Linux Platforms">Linux</a></td> | |
</tr> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#compilers_mac" title="Macintosh OS X">Macintosh OS X</a></td> | |
</tr> | |
</table> | |
<!-- COMPILER SETUP: WINDOWS ++++++++ --> | |
<!--<blockquote>--> | |
<div class="indent"> | |
<h3><a name="compilers_windows"></a>Microsoft Windows</h3> | |
<p>The NetBeans C/C++ module has been tested with compilers from Cygwin and | |
MinGW. If you install both Cygwin and MinGW, be careful to keep their installation | |
locations completely separate and do not mix tools from Cygwin and MinGW in | |
one tool collection in the IDE.</p> | |
<p class="notes"><strong>Note.</strong> If you want to use Qt with Windows, you must use MinGW, which is | |
included in the Qt SDK. You should not install MinGW separately.</p> | |
<table class="b-none vatop" cellpadding="0" cellspacing="0"> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#cygwin" title="Cygwin Compilers and Tools">Cygwin Compilers and Tools</a></td> | |
</tr> | |
<tr> | |
<td class="hyphen">- </td> | |
<td><a href="#mingw" title="MinGW Compilers and Tools">MinGW Compilers and Tools</a></td> | |
</tr> | |
</table> | |
<h4><a name="cygwin"></a>Cygwin Compilers and Tools</h4> | |
<p>The NetBeans C/C++ module has been tested with the following compilers | |
and tools from <a href="http://cygwin.com/" target="_blank">Cygwin.com</a>.</p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Tested</th> | |
<th class="tblheader" scope="col">Description</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>cygwin1.dll</tt></td> | |
<td class="tbltd1">1.7.7, 1.7.9 </td> | |
<td class="tbltd1">Cygwin Linux-like environment for Windows</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gcc</tt></td> | |
<td class="tbltd1">4.3.4</td> | |
<td class="tbltd1">Cygwin C compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>g++</tt></td> | |
<td class="tbltd1">4.3.4</td> | |
<td class="tbltd1">Cygwin C++ compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gdb</tt></td> | |
<td class="tbltd1">6.8</td> | |
<td class="tbltd1">Cygwin GNU debugger</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>make</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">Cygwin make utility</td> | |
</tr> | |
</tbody> | |
</table> | |
<br> | |
<p>If you already have the Cygwin gcc and g++ 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. | |
</p> | |
<p><b>To check the versions of your Cygwin compilers and tools:</b></p> | |
<ol> | |
<li> | |
<p>Check the version of Cygwin environment by typing the following commands at a Windows command prompt:</p> | |
<pre class="examplecode">C:\> cygcheck -c cygwin</pre> | |
</li> | |
<li>Check the versions of the Cygwin gcc and g++ compilers, <tt>make</tt>, and <tt>gdb</tt> by | |
typing the following commands at a Windows command prompt: | |
<pre class="examplecode">C:\> gcc --version | |
C:\> g++ --version | |
C:\> make --version | |
C:\> gdb --version | |
</pre> | |
</li> | |
</ol> | |
<p> | |
If you have the correct versions, then no further setup is | |
necessary. See <a href="#verifying">Verifying the Installation</a> to verify that | |
the tools are installed correctly for the NetBeans IDE.</p> | |
<p><b>To install the GNU gcc and g++ compilers, <tt>make</tt>, and <tt>gdb</tt> debugger from | |
<a href="http://cygwin.com/" target="blank">cygwin.com</a>:</b></p> | |
<ol> | |
<li>Refer to the <a href="http://cygwin.com/cygwin-ug-net/index.html" target="_blank">Cygwin User's Guide</a> for | |
complete information about installing and using Cygwin.</li> | |
<li>Download the Cygwin <tt>setup.exe</tt> program by clicking Install Cygwin in the left navigation bar, or by clicking this direct | |
<a href="http://www.cygwin.com/setup.exe"> | |
<tt>setup.exe</tt></a> link. | |
</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, which reveals the version number of the package to download. | |
At a minimum, select | |
<ul><li>gcc-core: C compiler | |
</li> | |
<li>gcc-g++: C++ compiler | |
</li> | |
<li>gdb: The GNU Debugger | |
</li> | |
<li>make: the GNU version of the 'make' utility | |
</li> | |
</ul> | |
Packages that are required by the packages you | |
select are automatically selected as well. | |
</li> | |
<li>Click Next to connect to the download site and download the packages you | |
selected, and click Finish when the installation is complete.</li> | |
<li> | |
Now add the Cygwin compiler directory to your path to enable NetBeans IDE | |
to find the tools collection: | |
<br><br> | |
<ol type="a"> | |
<li>Open the Control Panel:<br> | |
- On Windows XP select Start > Settings > Control Panel and | |
double-click System. <br> | |
- On Windows 7, type <b>var</b> in the Start menu's | |
search box to quickly find a link to Edit the system environment variables.</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. | |
Your edited path should look something like | |
<tt>%SystemRoot%\system32;%SystemRoot%;C:\Program Files\QuickTime\QTSystem;C:\cygwin\bin</tt></li> | |
<li>Click OK in the Environment Variables dialog and the System | |
Properties dialog. | |
</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
</li> | |
</ol> | |
<!-- MinGW installation --> | |
<h4><a name="mingw"></a>MinGW Compilers and Tools</h4> | |
<p>NetBeans IDE 7.2 was tested with Minimalist GNU for Windows (MinGW) and the Minimal System (MSYS) | |
Unix-like environment. Versions tested and installation instructions are shown below.</p> | |
<p class="notes margin-around"><strong>Note.</strong> If you want to use Qt with Windows, you should use the version of MinGW | |
<br>that is included in the Qt SDK instead of installing MinGW separately.</p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Tested</th> | |
<th class="tblheader" scope="col">Description</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gcc</tt></td> | |
<td class="tbltd1">4.6.2</td> | |
<td class="tbltd1">C compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>g++</tt></td> | |
<td class="tbltd1">4.6.2</td> | |
<td class="tbltd1">MinGW C++ compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gdb</tt></td> | |
<td class="tbltd1">7.4</td> | |
<td class="tbltd1">MinGW GNU debugger</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>make</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">MSYS <tt>make</tt> utility<br> | |
Note that MinGW make is not supported</td> | |
</tr> | |
</tbody> | |
</table> | |
<br> | |
<p><b>To install the GNU compilers, <tt>make</tt>, and <tt>gdb</tt> debugger from | |
<a href="http://mingw.org" target="_blank">mingw.org</a>:</b></p> | |
<ol> | |
<li>Log in to Windows using an account with computer administrator privileges. | |
</li> | |
<li>Download the self-extracting installer from | |
<a href="http://www.mingw.org/wiki/InstallationHOWTOforMinGW" target="_blank"> | |
How To Install the MinGW (GCC) Compiler Suite</a> on mingw.org or for convenience you | |
can download from this | |
<a href="http://sourceforge.net/projects/mingw/files/">direct link</a>. | |
</li> | |
<li>Run the MinGW installer in Windows.</li> | |
<li>In the MinGW installer, accept the defaults until you get to the Choose Components page.</li> | |
<li>On the Choose Components page, select the g++ compiler. The gcc compiler is automatically | |
included in the installation so it is not a selectable component.</li> | |
<li>Do not select MinGW make, as you need to use the make from MSYS instead, | |
which is downloaded separately. Click Next.</li> | |
<li>Use the default <tt>C:\MinGW</tt> as the destination folder if possible to minimize any potential difficulty with using | |
the compilers from another location.</li> | |
<li>Click Install to install the MinGW tools, then click Next, then click Finish.</li> | |
<li>Add the <tt>C:\MinGW\bin</tt> directory to your path, as described in | |
<a href="http://www.mingw.org/wiki/Getting_Started#toc4" target="_blank">Environment Settings</a> | |
in the MinGW wiki.</li> | |
<li>See the installation instructions for MSYS at the <a href="http://www.mingw.org/wiki/MSYS" target="_blank">MinGW MSYS wiki</a>. | |
You only need to install the MSYS 1.0 files. You do not need to | |
install the DTK or the core files mentioned in the wiki page.</li> | |
<li>For convenience, you can download from this | |
<a href="http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe">direct link to MSYS-1.0.10.exe</a> </li> | |
<li>Make sure you are using a Windows account with "computer administrator" privileges when you | |
install MSYS. The NetBeans IDE might have issues when you try to build and run projects later if MSYS | |
is installed under a limited user account.</li> | |
<li>Run the MSYS-1.0.10.exe installer and accept the defaults.</li> | |
<li>To install the gdb debugger, download from this | |
<a href="http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/GDB-7.0/gdb-7.0-2-mingw32-bin.tar.gz/download"> | |
direct link to gdb-7.0-2-mingw32-bin.tar.gz</a>. You must have a Windows zip utility such | |
as gzip, 7-zip, or WinZip to extract this gdb archive.</li> | |
<li>Unzip the gdb-7.0-2-mingw32-bin.tar.gz to your <tt>C:\MinGW</tt> directory so that the gdb | |
executable is installed into your <tt>C:\MinGW\bin</tt> directory.</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
<br> | |
<!-- COMPILER SETUP: SOLARIS OS --------------------------------> | |
<h3><a name="compilers_solaris"></a>Oracle Solaris OS</h3> | |
<p> | |
On the Oracle Solaris OS, you can use GNU tools or Oracle Solaris Studio tools. The GNU | |
tools are included in Oracle Solaris 10 OS and Oracle Solaris 11 OS in the <tt>/usr/sfw/bin</tt> directory by default. | |
The Oracle Solaris Studio software is a suite of developer tools that are free to download. | |
The Oracle Solaris Studio compilers are optimized for Sun hardware, and make it | |
easier to produce performance tuned Oracle Solaris binaries.</p> | |
<p>NetBeans IDE 7.2 has been tested with the following compilers and tools.</p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Tested</th> | |
<th class="tblheader" scope="col">Description</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>cc</tt></td> | |
<td class="tbltd1">5.10, 5.11, 5.12 </td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 C compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>CC</tt></td> | |
<td class="tbltd1">5.10, 5.11, 5.12 </td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 C++ compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gcc</tt></td> | |
<td class="tbltd1">3.4.3, 3.4.6</td> | |
<td class="tbltd1">GNU C compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>g++</tt></td> | |
<td class="tbltd1">3.4.3, 3.4.6 </td> | |
<td class="tbltd1">GNU C++ compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gdb</tt></td> | |
<td class="tbltd1">6.8</td> | |
<td class="tbltd1">GNU debugger</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gmake</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">GNU make</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>make</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">Solaris make</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>dmake</tt></td> | |
<td class="tbltd1">7.9, 8.0, 8.1 </td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 distributed make utility</td> | |
</tr> | |
</tbody> | |
</table> | |
<h4>Oracle Solaris Studio 12.3 Compilers</h4> | |
<p>If you want to use the Oracle Solaris Studio 12.3 compilers on Oracle Solaris 10 or Oracle Solaris 11:</p> | |
<ul> | |
<li>If you | |
have Oracle Solaris Studio 12.3 software installed, ensure that <tt>/<i>installation | |
directory</i>/solarisstudio12.3/bin</tt> | |
is in your path before you start the NetBeans IDE. The default location on | |
Solaris 10 OS and Solaris 11 OS is <tt>/opt/solarisstudio12.3/bin</tt></li> | |
<li> | |
If you do not have Oracle Solaris Studio 12.3 software installed, you can | |
download it free at <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-141149.html" target="_blank"> | |
<tt>http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-141149.html</tt></a>.</li> | |
</ul> | |
<p><b>To download and install the Oracle Solaris Studio 12.3 compilers on | |
Oracle Solaris 10:</b></p> | |
<ol> | |
<li>Create a directory for the downloaded file. | |
You must have write permission for this directory.</li> | |
<li> | |
Download the package installer 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> | /bin/tar xvf - | |
</pre> | |
</li> | |
<li>Follow the instructions in Chapter 2 of the <a href="http://docs.oracle.com/cd/E24457_01/html/E21988/index.html" target="_blank"><i>Oracle Solaris Studio 12.3 Installation Guide</i></a> to install the C compiler, C++ compiler, | |
and required Solaris patches.</li> | |
<li>Edit your <tt>PATH</tt> to add the path to the Oracle Solaris Studio 12.3 software before | |
starting the NetBeans IDE.</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
<p><b>To install the Oracle Solaris Studio 12.3 compilers on Oracle Solaris 11:</b></p> | |
<ul> | |
<li>Go to the <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-141149.html" target="blank">Oracle Solaris Studio download page</a> and follow the instructions for Oracle Solaris 11 in the Package Installation column. | |
</li> | |
</ul> | |
<h4>GNU Compilers and GNU <tt>make</tt></h4> | |
<p>If you want to use the GNU compilers and GNU <tt>make</tt>:</p> | |
<ul> | |
<li>If you have a standard installation of the Oracle Solaris 10 OS or Solaris 11 OS, the compilers and | |
<tt>gmake</tt> are installed in <tt>/usr/sfw/bin</tt>. Make sure that this | |
location is in your <tt>PATH</tt> before starting 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/" target="_blank">http://www.sunfreeware.com</a>.</li> | |
</ul> | |
<p><b>To download and install the GNU compilers and make utility</b></p> | |
<ol> | |
<li>Download <tt>gcc</tt> and <tt>make</tt>.</li> | |
<li>If the download zip files are not | |
automatically extracted during download, unzip them with <tt>gunzip</tt>. | |
</li> | |
<li>Install the packages with the <tt>pkgadd</tt> command.</li> | |
<li>Make sure to include the GNU | |
compiler directory and the GNU make directory in your path before starting the NetBeans IDE. | |
</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
<h4><tt>gdb</tt> Debugger</h4> | |
<p>Whether you use the Oracle Solaris 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 IDE. You can download <tt>gdb</tt> from | |
<a href="http://www.sunfreeware.com/" target="_blank">http://www.sunfreeware.com</a>. | |
</p> | |
<p><b>To download and install <tt>gdb</tt>:</b></p> | |
<ol> | |
<li>Download <tt>gdb</tt> 6.8.</li> | |
<li>If the download zip file is not | |
automatically extracted during download, unzip it with <tt>gunzip</tt>. | |
</li> | |
<li>Install the package with the <tt>pkgadd</tt> command.</li> | |
<li>Make sure to include the path to <tt>gdb</tt> in your <tt>PATH</tt> before starting | |
the NetBeans IDE.</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
<!-- COMPILER SETUP: LINUX OS +++++++++++++++++++++++++ --> | |
<h3><a name="compilers_linux"></a>Linux</h3> | |
<p>On Linux platforms, you can use GNU tools or Oracle Solaris Studio tools.</p> | |
<p>NetBeans IDE has been tested with the following compilers and tools:</p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Tested</th> | |
<th class="tblheader" scope="col">Description</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>cc</tt></td> | |
<td class="tbltd1"> 5.10, 5.11, 5.12 </td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>CC</tt></td> | |
<td class="tbltd1"> 5.10, 5.11, 5.12 </td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 compilers</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gcc</tt></td> | |
<td class="tbltd1">4.6.3</td> | |
<td class="tbltd1">GNU C compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>g++</tt></td> | |
<td class="tbltd1">4.6.3</td> | |
<td class="tbltd1">GNU C++ compiler</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gdb</tt></td> | |
<td class="tbltd1">7.4</td> | |
<td class="tbltd1">GNU debugger</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gmake</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">GNU make</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>dmake</tt></td> | |
<td class="tbltd1">7.9, 8.0, 8.1</td> | |
<td class="tbltd1">Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, and Oracle Solaris Studio 12.3 distributed make utility</td> | |
</tr> | |
</tbody> | |
</table> | |
<br><br> | |
<h4>Oracle Solaris Studio 12.2 Compilers on Linux</h4> | |
<p>If you want to use the Oracle Solaris Studio 12.3 compilers in a Linux OS:</p> | |
<ul> | |
<li>If you have Oracle Solaris Studio 12.3 software installed, ensure that <tt>/<i>installation | |
directory</i>/solarisstudio12.3/bin</tt> | |
is in your path before you start the NetBeans IDE. The default location | |
is <tt>/opt/oracle/solarisstudio12.3/bin</tt> when installing with Linux packages.</li> | |
<li> | |
If you do not have Oracle Solaris Studio 12.3 software installed, you can | |
download it free at <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-141149.html" target="_blank"> | |
<tt>http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-141149.html</tt></a>. | |
</li> | |
</ul> | |
<p><b>To download and install the Oracle Solaris Studio 12.3 compilers:</b></p> | |
<ol> | |
<li>Create a directory for the downloaded file. | |
You must have write permission for this directory.</li> | |
<li>If your browser is set to download to a particular location such as your Desktop or a Downloads directory without prompting, | |
set the browser preferences to download to the | |
directory you created. For Firefox, the download directory is set in Edit > Preferences > Main.</li> | |
<li>Download the file | |
for your platform into the download directory you created. If you are using Ubuntu, | |
download the tarfile installation into the directory where you want to install it because the packages are for Oracle Linux, Red Hat Enterprise Linux, and SuSE Linux Enterprise System. Note also | |
that Ubuntu is not an officially supported platform for Oracle Solaris Studio IDE, but the compilers | |
have been tested for use in NetBeans IDE and been found to work. | |
</li> | |
<li>Go to the download directory, and uncompress and untar the downloaded file. | |
<pre>bzcat <i>filename</i> | tar xvf - | |
</pre> | |
</li> | |
<li> | |
If you downloaded the RPM packages, follow the instructions in Chapter 2 of the <a href="http://download.oracle.com/docs/cd/E18659_01/html/821-1385/index.html" target="_blank"><i>Oracle Solaris Studio 12.3 Installation Guide</i></a> to install the C compiler, C++ compiler, and Fortran compiler.</li> | |
<li>Edit your <tt>PATH</tt> to add the path to the Oracle Solaris Studio software before | |
starting the NetBeans IDE.</li> | |
<li>See <a href="#verifying">Verifying the Installation</a> to verify that the tools were installed correctly | |
for the NetBeans IDE.</li> | |
</ol> | |
<p><b>To download and install the GNU debugger in Oracle Linux or Red Hat Enterprise Linux, type:</b></p> | |
<pre>yum install gdb</pre> | |
<p><b>To download and install the GNU debugger in Ubuntu, type:</b></p> | |
<pre>sudo apt-get install gdb</pre> | |
<!-- COMPILER SETUP: MAC OS X ----------------------------------> | |
<h3><a name="compilers_mac"></a>Macintosh OS X</h3> | |
<p> | |
NetBeans IDE has been tested with the following compilers | |
and tools:</p> | |
<table> | |
<tbody> | |
<tr> | |
<th class="tblheader" scope="col">Software or Resource</th> | |
<th class="tblheader" scope="col">Version Tested</th> | |
<th class="tblheader" scope="col">Description</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gcc</tt></td> | |
<td class="tbltd1">4.2.1</td> | |
<td class="tbltd1">GNU C compiler in Mac OS X 10.6</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>g++</tt></td> | |
<td class="tbltd1">4.2.1</td> | |
<td class="tbltd1">GNU C++ compiler in Mac OS X 10.6</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>gdb</tt></td> | |
<td class="tbltd1">6.3.5</td> | |
<td class="tbltd1">GNU debugger in Mac OS X 10.6</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><tt>make</tt></td> | |
<td class="tbltd1">3.81</td> | |
<td class="tbltd1">GNU make in Mac OS X 10.6</td> | |
</tr> | |
</tbody> | |
</table> | |
<br> | |
<p>Install the following packages that are provided with your Macintosh OS X:</p> | |
<ul> | |
<li>Xcode</li> | |
<li>X11</li> | |
</ul> | |
<p>These packages can also be downloaded from | |
<a href="http://developer.apple.com/mac" target="_blank">Apple Developer Connection</a> with | |
the free ADC membership.</p> | |
</div> | |
<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> | |
<div class="indent"> | |
<h3><a name="start">Start the NetBeans IDE</a></h3> | |
<p><b>To start the IDE, do one of the following:</b></p> | |
<ul> | |
<li>Double-click the NetBeans IDE icon on the desktop.</li> | |
<li>On Linux or Solaris platforms, navigate to the <tt>bin</tt> subdirectory of your NetBeans installation and | |
type <tt>./netbeans</tt>. | |
</li> | |
<li>Launch the NetBeans IDE through the desktop menu. | |
<br>This method is available on Windows platforms, but might not be available | |
on the Solaris 10 OS and Solaris 11 OS and some Linux platforms.</li> | |
</ul> | |
<h3><a name="test"></a>Build a Sample Project to Test the Tools</h3> | |
<p>On all platforms, you can build a sample project to test the compiler installation, | |
and run it in the debugger to test the gdb installation.</p> | |
<p><b>To build a sample project and run it in the debugger:</b></p> | |
<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 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 window, right-click the <tt>Welcome_1</tt> project and | |
choose Build. 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>Expand the Source Files node of the project and double-click the <tt>welcome.cc</tt> file to open it in the Source | |
Editor.</li> | |
<li>Set a breakpoint by clicking in the left margin of the Source | |
Editor window next to any line. | |
</li> | |
<li>Right-click the project and choose Debug. 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 Welcome application | |
runs and stops at the breakpoint. | |
</li> | |
<li>Choose Debug > Continue to run the application to completion. | |
</li> | |
<li>If the project doesn't build or debugger doesn't work, see the next section.</li> | |
</ol> | |
</div> | |
<h2><a name="ts"></a>Troubleshooting Tool Issues</h2> | |
<ol> | |
<li>Select Tools > Options and click C/C++ in the top panel of the Options dialog box.</li> | |
<li>In the Build Tools tab, look at the Tool Collection list to see if your | |
tool collection is listed.</li> | |
<li>Select the tool collection if it is listed, and check the paths to the tools. | |
If the Base Directory path is incorrect, you may have made a mistake when setting | |
your path environment variable. Refer back to the instructions for setting the path in the section for your platform | |
in this document, and correct the path if necessary.</li> | |
<li>If the tool collection is not listed, click Restore Defaults. This will | |
cause the IDE to rescan your environment to look for tools and the tool collection | |
should be found if the path environment variable is correct.</li> | |
<li>If you are still having an issue, try adding a new tool collection and | |
specifying the path to the tools, as follows: | |
<ol type="a"> | |
<li>Click Add below the Tool Collection list.</li> | |
<li>Browse to the directory that contains the executables for the compilers, debugger, and | |
make utility. This is usually the <tt>bin</tt> directory.</li> | |
<li>Select the directory and click Open. The IDE should be able to determine the family | |
of the tools and update the other fields in the dialog box appropriately. If not, an error | |
is displayed.</li> | |
<li>If the tools are identified correctly, click OK in the Add Tool Collection dialog box. | |
The new collection should be displayed in the list.</li> | |
<li>Select the new tool collection and click Default to make sure this tool collection | |
is used automatically for new projects.</li> | |
</ol> | |
<p class="tips">If you cannot solve the problem, ask for help at the | |
<a href="http://forums.netbeans.org/cnd-users.html" target="_blank">NetBeans C/C++ User Forum</a>.</p> | |
</li> | |
</ol> | |
<!-- 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/docs/cnd/quickstart.html">C/C++ | |
Projects Quick Start Tutorial</a> | |
</p> | |
<div class="feedback-box"><a href="mailto:users@cnd.netbeans.org?subject=Feedback:%20Configuring%20the%20NetBeans%20IDE%20for%20C/C++/Fortran%20-%20NetBeans%20IDE%207.2">Send Us Your Feedback</a></div> | |
</body> | |
</html> |