Friday, July 18, 2014

NetBeans: Configuring NetBeans IDE for C/C++

In this article, we will demonstrate how to install NetBeans IDE 8.0 and configure it for C/C++.

Installation steps:
  1. NetBeans IDE 8.0
  2. C/C++ plugin module
  3. Compiler and Tools

     

    NetBeans IDE


    From [1], you can choose which bundle (based on supported technologies) to download.  The choices include:
    •  Java SE
    •  Java EE
    •  C/C++
    •  HTML5 & PHP
    •  All
    If you have downloaded either "C/C++" or "All" bundle, C/C++ plugin module (see next section) is already included.

    C/C++ plugin module


    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.

    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.[2]
    1. 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.
    2. Choose Tools > Plugins.
    3. In the Plugins dialog box, click the Available Plugins tab, and scroll to the C/C++ category.
    4. Select the C/C++ checkbox and click Install to start the NetBeans IDE Installer.
    5. In the NetBeans IDE Installer, click Next.
    6. Read the license agreement, select the checkbox to accept the terms of the license agreement, and click Next.
    7. Click Install.
    8. After the installation completes, select either Restart IDE Now or Restart IDE Later and click Finish.

    Compiler and Tools


    The Netbeans C/C++ module requires a C compiler, C++ compiler, make utility, and gdb debugger. See [3] on the instructions for the platform of your development system.  Here we will use Micorsoft Windows as our platform and use the tools provided in cygwin for the demonstration.

    The NetBeans C/C++ module has been tested with the following compilers and tools from Cygwin.com.  However, if your version is newer, it seems to work fine too.


    Software or ResourceVersion TestedDescription
    cygwin1.dll1.7.7, 1.7.9 Cygwin Linux-like environment for Windows
    gcc4.3.4Cygwin C compiler
    g++4.3.4Cygwin C++ compiler
    gdb6.8Cygwin GNU debugger
    make3.81Cygwin make utility


    To download the compiler and tools you needed for C/C++ plugin, you can go to [4] and select one of the mirror sites.



    Note that you could select the appropriate package to download by specifying your compiler name or tool name.  If you select all packages to download, it will take hours.

    In the figure, we have specified g++ in the Search field.  Cygwin Setup was able to identify which package containing the interested product.  For example, we have selected GNU Complier for the download.

    After you have downloaded all packages that are needed for the C/C++ plugin module.  You should follow the instructions in [2] to configure it.  If you didn't set them up correctly, you will run into this "No Compiler" error.



    Then just follow the provided instructions to fix the issue.  For example, here is the tool collection we have in the environment:


    As you can see, most of our tools are provided from the cygwin64 installation.  But, you don't need to specify everything out of your cygwin64 installation.  For example, we have chosen make.exe out of our MKS Toolkit installation (see [5]).

    References

    1. Download NetBeans IDE
    2. Configuring NetBeans IDE 8.0 for C/C++/Fortran
    3. Installing and Setting Up the Compilers and Tools
    4. cygwin.com
    5. Tool Collection Notes
      • Dependency checking requires support from your tool collection (make and compilers). 
        • It has been tested with the Oracle Solaris Studio tool collection and GNU tool collections including Cygwin and MinGW. 
        • Dependency checking works when Oracle Solaris Studio compilers are used together with Oracle Solaris make and when GNU compilers are used with GNU gmake. Mixing Oracle Solaris make with GNU compilers and vice versa is not supported. 
    6. NetBeans Community Day at JavaOne 2014
    7. Netbeans: Is it possible to install mulltiple Netbeans for each different development need?
    8. NetBeans IDE 8.1 Download
      • With installation of NetBeans 8.1, I need to change "Make Command" to use:
        • C:\cygwin64\bin\bin\make.exe
    9. Eclipse CDT: Symbol 'cout' could not be resolved
      • To resolve this issue in NetBeans, select Project Properties -> Build -> C++ Compiler -> Additional Options and add Use -std=c++11.
    10. NetBeans invalid jdkhome specified fix
      • Navigate to your NetBeans installation folder which by default should beC:\Program Files\NetBeans and look for the folder etc. Inside that folder should be a file with the name netbeans.conf. What you need to do is to open the file with your favorite text reader (notepad as an example) and look for the line that starts with netbeans_jdkhome=.

    No comments: